Java tutorial
//package com.java2s; //License from project: Apache License public class Main { /** * Convert the hex string to the integer value. * @param str * @return the integer value for the specified hex string */ public static int intFromHexString(CharSequence str) { int n = 0; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); int v = c <= '9' ? c - '0' : c - 'a' + 10; n <<= 4; n |= (v & 0x0f); } return n; } }