Here you can find the source of toInt(String string)
public static int toInt(String string)
//package com.java2s; public class Main { public static int toInt(String string) { if (string.length() != 4) throw new IllegalArgumentException( "length must be 4, got \"" + string + "\", length=" + string.length()); byte[] bytes = string.getBytes(); return ((bytes[0] & 0xFF) << 24) | ((bytes[1] & 0xFF) << 16) | ((bytes[2] & 0xFF) << 8) | (bytes[3] & 0xFF); }//from w w w.j a v a2 s . c o m }