Scanner scan=new Scanner("11, " + "22, 33, 44"); scan.useDelimiter("\\s*,\\s*"); while(scan.hasNextInt()){ System.out.println(scan.nextInt()); }