Utils { public static String getValueShortString(BigInteger number) { BigInteger result = number; int pow = 0; while (result.compareTo(_1000_) == 1 || result.compareTo(_1000_) == 0) { result = result.divide(_1000_); pow += 3; } return result.toString() + "·(" + "10^" + pow + ")"; }  static BigInteger unifiedNumericToBigInteger(String number); static String longToDateTime(long timestamp); static String getValueShortString(BigInteger number); static byte[] addressStringToBytes(String hex); static boolean isValidAddress(byte[] addr); static String getAddressShortString(byte[] addr); static SecureRandom getRandom(); static String getHashListShort(List<byte[]> blockHashes); static double JAVA_VERSION; }
@Test public void testGetValueShortString1() { String expected = "123·(10^24)"; String result = Utils.getValueShortString(new BigInteger("123456789123445654363653463")); assertEquals(expected, result); }
@Test public void testGetValueShortString2() { String expected = "123·(10^3)"; String result = Utils.getValueShortString(new BigInteger("123456")); assertEquals(expected, result); }
@Test public void testGetValueShortString3() { String expected = "1·(10^3)"; String result = Utils.getValueShortString(new BigInteger("1234")); assertEquals(expected, result); }
@Test public void testGetValueShortString4() { String expected = "123·(10^0)"; String result = Utils.getValueShortString(new BigInteger("123")); assertEquals(expected, result); }
@Test public void testGetValueShortString5() { byte[] decimal = Hex.decode("3913517ebd3c0c65000000"); String expected = "69·(10^24)"; String result = Utils.getValueShortString(new BigInteger(decimal)); assertEquals(expected, result); }