"2345 * 2341"
String s = "2345 * 2341"; String1 = 2345in the following way:
String2 = 2341
String String1 = 2345; String String2 = 2341; public boolean validNumber() throws IOException { input = getUserInput(); boolean valid = false; int i = 0; for (valid = true; i < input.length();) { if (input.charAt(i) == '0' && input.charAt(i) == '1' && input.charAt(i) == '2' && input.charAt(i) == '3' && input.charAt(i) == '4' && input.charAt(i) == '5' && input.charAt(i) == '6' && input.charAt(i) == '7' && input.charAt(i) == '8' && input.charAt(i) == '9') { valid = true; }else{ valid = false; } i++; } return valid; } public void check() throws IOException { boolean valid = validNumber(); int i = 0; while (valid = true && i < 1){ if (input.contains(" + ")) { plus(); } else if (input.contains(" - ")) { minus(); } else if (input.contains(" / ")) { divide(); } else if (input.contains(" * ")) { multiply(); }else { System.out.println("Error Incorrect Input"); System.out.println("Reinput your numbers"); } check(); } } } }