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