Here you can find the source of tryParse(String s, Integer defaultValue)
public static Integer tryParse(String s, Integer defaultValue)
//package com.java2s; public class Main { public static Integer tryParse(String s, Integer defaultValue) { try {/*from ww w. j a va2s.c o m*/ return Integer.parseInt(s); } catch (Exception e) { return defaultValue; } } public static Integer tryParse(String text, int maxLow, int maxHigh) { Integer i = tryParse(text, null); if (i == null || i < maxLow || i > maxHigh) { i = null; } return i; } }