private static int validateAdbServerPort(@NonNull String adbServerPort) throws IllegalArgumentException {
  try {
    int port=Integer.decode(adbServerPort);
    if (port <= 0 || port >= 65535) {
      throw new IllegalArgumentException("Should be > 0 and < 65535");
    }
    return port;
  }
 catch (  NumberFormatException e) {
    throw new IllegalArgumentException("Not a valid port number");
  }
}

private static int validateAdbServerPort ( @ NonNull String adbServerPort ) throws IllegalArgumentException { try { int port = Integer . decode ( adbServerPort ) ; if ( port <= 0 || port >= 65535 ) { throw new IllegalArgumentException ( "Should be > 0 and < 65535" ) ; } return port ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( "Not a valid port number" ) ; } }
returns the integer port value if it is a valid value for adb server port
