Here you can find the source of toInteger(String val)
public static Integer toInteger(String val)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { public static Integer toInteger(String val) { return isBlank(val) ? null : new Integer(val.trim()); }//from w w w. j a va 2s . c o m public static boolean isBlank(String value) { return value == null || value.trim().length() == 0; } public static String trim(String str, String trim) { int start = 0; while (str.startsWith(trim, start)) start += trim.length(); str = str.substring(start); while (str.endsWith(trim)) str = str.substring(0, str.length() - trim.length()); return str; } }