Here you can find the source of toInteger(Object val)
public static Integer toInteger(Object val)
//package com.java2s; public class Main { public static Integer toInteger(Object val) { if (val == null) return null; if (val instanceof Number) return Integer.valueOf(((Number) val).intValue()); return Integer.valueOf(val.toString().trim()); }//from ww w . j a va2 s. co m public static String toString(int... results) { StringBuilder sb = new StringBuilder(); sb.append('['); sb.append(' '); for (int i : results) sb.append(i).append(','); sb.setCharAt(sb.length() - 1, ' '); sb.append(']'); return sb.toString(); } }