Here you can find the source of tryParse(String value, String defaultValue)
public static String tryParse(String value, String defaultValue)
//package com.java2s; //License from project: Apache License public class Main { public static Integer tryParse(String value, int defaultValue) { try {//from w ww . j av a 2 s . co m 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; } } }