public static boolean isNumeric(String maybeNumeric){
  return maybeNumeric != null && maybeNumeric.matches("[0-9]+");
}

public static boolean isNumeric ( String maybeNumeric ) { return maybeNumeric != null && maybeNumeric . matches ( "[0-9]+" ) ; }
checks whether a string contains only number or not using a regex . i like this approach since it doesn ' t need to parse it into a numerical variable which may not fit into any particularly type
