fork download
  1. class Main
  2. {
  3. public static void main (String[] args) throws java.lang.Exception
  4. {
  5. String inputString = "1,4,6,22,88,105:22";
  6. int min = 1;
  7. int max = 105;
  8. String[] splitString = inputString.split("[,:]");
  9. for (String part : splitString)
  10. {
  11. int parsedInt = Integer.parseInt(part);
  12. if (parsedInt < min || parsedInt > max)
  13. throw new Exception("Invalid");
  14. }
  15. System.out.println("Yay it's ok!");
  16. }
  17. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
Yay it's ok!