/* package whatever; // don't place package name! */ import java.math.BigDecimal; import java.math.BigInteger; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { Ideone numTest = new Ideone(); numTest.numberTestDemo(); } private void numberTestDemo() { /*Decimal String Part*/ showRadixInfo(bigInt4mDecimalString); byte[] byte4mDec = bigInt4mDecimalString.toByteArray(); printByteInfo(byte4mDec); /*Exponent String Part*/ /* Copying the same exact Scientific notation from decimalString to exponentString*/ showRadixInfo(bigDecimal4mExponentString.toBigIntegerExact()); byte[] byte4mExp = bigDecimal4mExponentString.unscaledValue().toByteArray(); printByteInfo(byte4mExp); if (bigDecimal4mExponentString.toBigIntegerExact().equals(bigInt4mDecimalString)) else } return bigInt; } return bigDecimal; } } private void printByteInfo(byte[] buff) { for(int i = 0; i < buff.length; i++) for(int i = 0; i < buff.length; i++) { } } StringBuilder sb = new StringBuilder("00000000"); for (int bit = 0; bit < sb.length(); bit++) { if (((n >> bit) & 1) > 0) sb.setCharAt(7 - bit, '1'); } return sb.toString(); } }
Standard input is empty
Decimal String Part : decimalString : 998446744073709551615 Scientific notation in double format : 9.98447e+20 Scientific notation in String format : 9.984467440737096E20 Decimal-String Radix Info : Binary : 1101100010000000111011011001111011110011001010110011111111111111111111 Octal : 154200733173631263777777 Decimal : 998446744073709551615 Hexa : 0x36203B67BCCACFFFFF Bit length : 70 Bit count : 46 Decimal-String Byte Info : Byte Array : [54,32,59,103,188,202,207,255,255,] Binary-Byte : 00110110 00100000 00111011 01100111 10111100 11001010 11001111 11111111 11111111 Hex-Byte : 0x36203B67BCCACFFFFF Exponent String Part : exponentString : 9.984467440737096E20 Exponent String Radix Info : Binary : 1101100010000000111011011001111011110011001010110100001011110100000000 Octal : 154200733173631264136400 Decimal : 998446744073709600000 Hexa : 0x36203B67BCCAD0BD00 Bit length : 70 Bit count : 33 Exponent String Byte Info : Byte Array : [35,120,209,251,19,155,72,] Binary-Byte : 00100011 01111000 11010001 11111011 00010011 10011011 01001000 Hex-Byte : 0x2378D1FB139B48 Both BigInts are not equal