Here you can find the source of tryParse(String value, int defaultValue)
public static Integer tryParse(String value, int defaultValue)
//package com.java2s; //License from project: Apache License public class Main { public static Integer tryParse(String value, int defaultValue) { try {/*from w w w . j av a 2 s . com*/ return Integer.parseInt(value); } catch (NumberFormatException e) { return defaultValue; } } public static String tryParse(String value, String defaultValue) { try { return String.valueOf(Integer.parseInt(value)); } catch (NumberFormatException e) { return defaultValue; } } }