Here you can find the source of tryParseInt(String s)
public static int tryParseInt(String s)
//package com.java2s; //License from project: Open Source License public class Main { public static int tryParseInt(String s) { try {//from w w w .j a v a2 s. c om return Integer.parseInt(s); } catch (NumberFormatException e) { return -1; } } }