Here you can find the source of tryParseInt(String value)
public static int tryParseInt(String value)
//package com.java2s; //License from project: Apache License public class Main { public static int tryParseInt(String value) { try {// www. j a v a 2 s . c om return Integer.parseInt(value); } catch (Exception e) { return -1; } } public static int tryParseInt(String value, int defaultValue) { try { return Integer.parseInt(value); } catch (Exception e) { return defaultValue; } } }