Here you can find the source of intArray(String data)
public static int[] intArray(String data)
//package com.java2s; //License from project: Open Source License public class Main { public static int[] intArray(String data) { if (data == null || data.equals("")) return new int[0]; String[] split = data.split(" "); int[] r = new int[split.length]; for (int i = 0; i < r.length; i++) { try { r[i] = Integer.parseInt(split[i]); } catch (NumberFormatException e) { r[i] = 0;/* w ww.ja va 2s. c om*/ } } return r; } public static int parseInt(String s) { if (s != null) { try { return Integer.parseInt(s); } catch (NumberFormatException e) { } // Do nothing } return 0; } }