Here you can find the source of parseInt(String arg, int defaultValue)
public static int parseInt(String arg, int defaultValue)
//package com.java2s; public class Main { public static int parseInt(String arg, int defaultValue) { if (arg == null) { return defaultValue; }//from www. j av a2s. co m try { return Integer.parseInt(arg); } catch (NumberFormatException e) { return defaultValue; } } }