Java tutorial
//package com.java2s; public class Main { /** * Parses an integer silently. Returns the Integer value of the given string. * Returns null if the input string is null, empty or if it cannot be parsed. * * @param string the string. * @return an Integer. */ public static Integer parseInt(String string) { if (string == null || string.trim().isEmpty()) { return null; } try { return Integer.parseInt(string); } catch (NumberFormatException ex) { return null; } } }