Java tutorial
//package com.java2s; public class Main { /** * <p>Extract integer values from an array of strings into an array of int.</p> * * <p>Exceptions in the format of the string are trapped and 0 value(s) returned.</p> * * @param src an array of strings, each of which should be an integer numeric value * @return an array of int */ static public int[] copyStringToIntArray(String[] src) { if (src == null) return null; int n = src.length; int[] dst = new int[n]; for (int j = 0; j < n; ++j) { int value = 0; try { value = Integer.valueOf(src[j]).intValue(); } catch (NumberFormatException e) { } catch (NullPointerException e) { } dst[j] = value; } return dst; } }