Here you can find the source of toUnsignedString(BigDecimal bigDecimal, int shift)
public static String toUnsignedString(BigDecimal bigDecimal, int shift)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.util.*; public class Main { final static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; public static String toUnsignedString(BigDecimal bigDecimal, int shift) { BigDecimal divisor = new BigDecimal(shift); Deque<Character> numberDeque = new ArrayDeque<Character>(); do {//www . ja va 2 s . c o m BigDecimal[] ba = bigDecimal.divideAndRemainder(divisor); bigDecimal = ba[0]; numberDeque.addFirst(digits[ba[1].intValue()]); } while (bigDecimal.compareTo(BigDecimal.ZERO) > 0); StringBuilder builder = new StringBuilder(); for (Character character : numberDeque) { builder.append(character); } return builder.toString(); } }