Java examples for java.lang:Number
from Base 62 number
//package com.java2s; public class Main { private static final String baseDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public static int fromBase62(String base62Number) { return fromOtherBaseToDecimal(62, base62Number); }//from w w w . jav a 2 s. co 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; } }