I need a boolean method that returns true if string represents an integer
Here is my code..I can get this to work
what am I doing wrong here??Code:public class ASD {
public static void main(String args[]) {
isInteger("230987");
}
public static boolean isInteger(String source) {
char c;
for (int x = 0; x < source.length(); x++) {
c = source.charAt(x);
if (c == 0 || c == 1 || c == 2 || c == 3 || c == 4 || c == 5 || c == 6 || c == 7 || c == 8 || c == 9) {
return true;
} else {
return false;
}
}
}
}

