Here you can find the source of toInteger(String value)
public static Integer toInteger(String value)
//package com.java2s; //License from project: Open Source License public class Main { public static Integer toInteger(String value) { Integer integer = null;/*from w w w. j ava2 s. co m*/ try { integer = Integer.parseInt(value); } catch (Exception e) { integer = null; } return integer; } public static int parseInt(String intString, int defaultValue) { int parsedInt = defaultValue; try { parsedInt = Integer.parseInt(intString); } catch (Exception e) { parsedInt = defaultValue; } return parsedInt; } }