This method of the DirectInput Class queries the joystick driver for the number of joysticks it supports.
public int getNumDevs();
Returns the number of joysticks the driver supports; otherwise, returns zero if no driver is present.