I am uisng the folowing logic to check if a String recievied is a valid number or not
package com;
public class Test {
public static void main(String args[]) {
String str = "122";
boolean b = isNumb(str);
System.out.println(b);
}
public static boolean isNumb(String str) {
String s = str;
for (int i = 0; i < s.length(); i++) {
if (!Character.isDigit(s.charAt(i)))
return false;
}
return true;
}
}
I am going to use this in a highly multithreaded environment where there can be 800 - 900 concurrent users at a time , please let me know , if this code has got any loop holes or not ??
Please share your views
Thanks in advance