Java BigInteger Calculate integerToString(BigInteger value)

Here you can find the source of integerToString(BigInteger value)

Description

integer To String

License

Open Source License

Declaration

public static String integerToString(BigInteger value) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigInteger;

public class Main {
    public static String integerToString(BigInteger value) {
        StringBuilder s = new StringBuilder();

        while (value.bitLength() > 0) {
            BigInteger[] result = value.divideAndRemainder(BigInteger.valueOf(62));
            value = result[0];/*from ww  w  . j a  va2s .c  o  m*/

            char c = intToChar(result[1].intValue());
            s.insert(0, c);

        }

        return s.toString();

    }

    private static char intToChar(int i) {
        if (i < 36)
            return Character.forDigit(i, 36);
        else
            return Character.toUpperCase(Character.forDigit(i - 26, 36));
    }
}

Related

  1. getVersionString(BigInteger versionNumber)
  2. greater(BigInteger i1, BigInteger i2)
  3. hexEncode(BigInteger bigInteger)
  4. increment(BigInteger integer)
  5. int2zpBin(BigInteger num, int len)
  6. intValue(BigInteger bi)
  7. intValueExact(BigInteger bigint)
  8. jsonBigInteger(JsonValue value)
  9. length(BigInteger bi)