Here you can find the source of convert(BigInteger value, int base, boolean extra)
Parameter | Description |
---|---|
The | value to convert. |
base | The base. |
True | if prefix or suffix needed, false if not. |
public static String convert(BigInteger value, int base, boolean extra)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; public class Main { /**//from www . java2 s .co m * Convert value to a string in the given base. * * @param The value to convert. * @param base The base. * @param True if prefix or suffix needed, false if not. * * @return the string. */ public static String convert(BigInteger value, int base, boolean extra) { if (base == 2) { if (extra) return value.toString(2) + "B"; else return value.toString(2); } else if (base == 10) { return value.toString(); } else if (base == 16) { if (extra) return "0x" + value.toString(16); else return value.toString(16); } return ""; // shouldn't happen } }