Java examples for java.lang:Number
from Base 16 number
//package com.java2s; public class Main { private static final String baseDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public static int fromBase16(String base16Number) { return fromOtherBaseToDecimal(16, base16Number); }// w ww .j a v a2s .c o m private static int fromOtherBaseToDecimal(int base, String number) { int iterator = number.length(); int returnValue = 0; int multiplier = 1; while (iterator > 0) { returnValue = returnValue + (baseDigits.indexOf(number.substring(iterator - 1, iterator)) * multiplier); multiplier = multiplier * base; --iterator; } return returnValue; } }