Looks like people like doing spoonfeeding, so I have decided to post the worst solution to an easy task:
public static boolean isNumber(String s) throws Exception {
boolean result = false;
byte[] bytes = s.getBytes("ASCII");
int tmp, i = bytes.length;
while (i >0 && (result = ((tmp = bytes[--i] - '0') >= 0) && tmp <= 9));
return result;
}
About the worst code I could imagine, but there might be other people here who can come up with even worse solutions.
Hm, containsNumber is worse:
public static boolean containsNumber(String s) throws Exception {
boolean result = false;
byte[] bytes = s.getBytes("ASCII");
int tmp, i = bytes.length;
while (i >0 && (true | (result |= ((tmp = bytes[--i] - '0') >= 0) && tmp <= 9)));
return result;
}