Java tutorial
//package com.java2s; public class Main { public static int[] readIntArray(String s) { if ((s == null) || (s.equalsIgnoreCase(""))) { return null; } String[] ints = s.split(" "); if ((ints == null) || (ints.length == 0)) { return null; } int[] r = new int[ints.length]; int i = 0; for (String ss : ints) { r[i++] = Integer.parseInt(ss); } return r; } }