code: @SuppressWarnings("unchecked")
      public static <T extends Number> T isNumber( String value, Class<T> adaptee ) {
          if (value == null) {
              return null;
          }
          if (adaptee == null) {
              adaptee = (Class<T>) Double.class;
          }
          if (adaptee.isAssignableFrom(Double.class)) {
              try {
                  Double parsed = Double.parseDouble(value);
                  return adaptee.cast(parsed);
              } catch (Exception e) {
                  return null;
              }
          } else if (adaptee.isAssignableFrom(Float.class)) {
              try {
                  Float parsed = Float.parseFloat(value);
                  return adaptee.cast(parsed);
              } catch (Exception e) {
                  return null;
              }
          } else if (adaptee.isAssignableFrom(Integer.class)) {
              try {
                  Integer parsed = Integer.parseInt(value);
                  return adaptee.cast(parsed);
              } catch (Exception e) {
                  try {
                      // try also double and convert by truncating
                      Integer parsed = (int) Double.parseDouble(value);
                      return adaptee.cast(parsed);
                  } catch (Exception ex) {
                      return null;
                  }
              }
          } else {
              throw new IllegalArgumentException();
          }
      }
docs: Checks if a string is a number (currently Double, Float, Integer).
  @param <T>
  
  @param value the string to check.
  @param adaptee the class to check against. If null, the more permissive {@link Double} will be used.
  @return the number or <code>null</code>, if the parsing fails.