test_class.file: core/src/test/java/com/google/bitcoin/core/UtilsTest.java
test_class.identifier: UtilsTest
test_case.body: @Test
      public void testBitcoinValueToPlainString() {
          // null argument check
          try {
              bitcoinValueToPlainString(null);
              org.junit.Assert.fail("Expecting IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              assertTrue(e.getMessage().contains("Value cannot be null"));
          }
  
          assertEquals("0.0015", bitcoinValueToPlainString(BigInteger.valueOf(150000)));
          assertEquals("1.23", bitcoinValueToPlainString(toNanoCoins("1.23")));
  
          assertEquals("0.1", bitcoinValueToPlainString(toNanoCoins("0.1")));
          assertEquals("1.1", bitcoinValueToPlainString(toNanoCoins("1.1")));
          assertEquals("21.12", bitcoinValueToPlainString(toNanoCoins("21.12")));
          assertEquals("321.123", bitcoinValueToPlainString(toNanoCoins("321.123")));
          assertEquals("4321.1234", bitcoinValueToPlainString(toNanoCoins("4321.1234")));
          assertEquals("54321.12345", bitcoinValueToPlainString(toNanoCoins("54321.12345")));
          assertEquals("654321.123456", bitcoinValueToPlainString(toNanoCoins("654321.123456")));
          assertEquals("7654321.1234567", bitcoinValueToPlainString(toNanoCoins("7654321.1234567")));
          try {
              assertEquals("87654321.12345678", bitcoinValueToPlainString(toNanoCoins("87654321.12345678")));
              Assert.fail();  // More than MAX_MONEY
          }
          catch (AssertionError e ) {}
          catch (Exception e) {}
  
          // check there are no trailing zeros
          assertEquals("1", bitcoinValueToPlainString(toNanoCoins("1.0")));
          assertEquals("2", bitcoinValueToPlainString(toNanoCoins("2.00")));
          assertEquals("3", bitcoinValueToPlainString(toNanoCoins("3.000")));
          assertEquals("4", bitcoinValueToPlainString(toNanoCoins("4.0000")));
          assertEquals("5", bitcoinValueToPlainString(toNanoCoins("5.00000")));
          assertEquals("6", bitcoinValueToPlainString(toNanoCoins("6.000000")));
          assertEquals("7", bitcoinValueToPlainString(toNanoCoins("7.0000000")));
          assertEquals("8", bitcoinValueToPlainString(toNanoCoins("8.00000000")));
      }
test_case.class_method_signature: UtilsTest.testBitcoinValueToPlainString()
test_case.full_signature: @Test public void testBitcoinValueToPlainString()
test_case.identifier: testBitcoinValueToPlainString
test_case.invocations: bitcoinValueToPlainString fail assertTrue contains getMessage assertEquals bitcoinValueToPlainString valueOf assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins fail assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins assertEquals bitcoinValueToPlainString toNanoCoins
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBitcoinValueToPlainString()
focal_class.declarator: NEGATIVE_ONE = BigInteger.valueOf(-1)
focal_class.modifier: public static final
focal_class.original_string: public static final BigInteger NEGATIVE_ONE = BigInteger.valueOf(-1);
focal_class.type: BigInteger
focal_class.var_name: NEGATIVE_ONE
focal_class.declarator: digest
focal_class.modifier: private static final
focal_class.original_string: private static final MessageDigest digest;
focal_class.type: MessageDigest
focal_class.var_name: digest
focal_class.declarator: BITCOIN_SIGNED_MESSAGE_HEADER = CoinDefinition.coinName + " Signed Message:\n"
focal_class.modifier: public static final
focal_class.original_string: public static final String BITCOIN_SIGNED_MESSAGE_HEADER = CoinDefinition.coinName + " Signed Message:\n";
focal_class.type: String
focal_class.var_name: BITCOIN_SIGNED_MESSAGE_HEADER
focal_class.declarator: BITCOIN_SIGNED_MESSAGE_HEADER_BYTES = BITCOIN_SIGNED_MESSAGE_HEADER.getBytes(Charsets.UTF_8)
focal_class.modifier: public static final
focal_class.original_string: public static final byte[] BITCOIN_SIGNED_MESSAGE_HEADER_BYTES = BITCOIN_SIGNED_MESSAGE_HEADER.getBytes(Charsets.UTF_8);
focal_class.type: byte[]
focal_class.var_name: BITCOIN_SIGNED_MESSAGE_HEADER_BYTES
focal_class.declarator: COIN = new BigInteger("100000000", 10)
focal_class.modifier: public static final
focal_class.original_string: public static final BigInteger COIN = new BigInteger("100000000", 10);
focal_class.type: BigInteger
focal_class.var_name: COIN
focal_class.declarator: CENT = new BigInteger("1000000", 10)
focal_class.modifier: public static final
focal_class.original_string: public static final BigInteger CENT = new BigInteger("1000000", 10);
focal_class.type: BigInteger
focal_class.var_name: CENT
focal_class.declarator: mockSleepQueue
focal_class.modifier: private static
focal_class.original_string: private static BlockingQueue<Boolean> mockSleepQueue;
focal_class.type: BlockingQueue<Boolean>
focal_class.var_name: mockSleepQueue
focal_class.declarator: mockTime
focal_class.modifier: public static volatile
focal_class.original_string: public static volatile Date mockTime;
focal_class.type: Date
focal_class.var_name: mockTime
focal_class.declarator: bitMask[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}
focal_class.modifier: private static final
focal_class.original_string: private static final int bitMask[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
focal_class.type: int
focal_class.var_name: bitMask
focal_class.file: core/src/main/java/com/google/bitcoin/core/Utils.java
focal_class.identifier: Utils
focal_class.class_method_signature: Utils.toNanoCoins(int coins, int cents)
focal_class.full_signature: public static BigInteger toNanoCoins(int coins, int cents)
focal_class.identifier: toNanoCoins
focal_class.modifiers: public static
focal_class.parameters: (int coins, int cents)
focal_class.return: BigInteger
focal_class.signature: BigInteger toNanoCoins(int coins, int cents)
focal_class.class_method_signature: Utils.bigIntegerToBytes(BigInteger b, int numBytes)
focal_class.full_signature: public static byte[] bigIntegerToBytes(BigInteger b, int numBytes)
focal_class.identifier: bigIntegerToBytes
focal_class.modifiers: public static
focal_class.parameters: (BigInteger b, int numBytes)
focal_class.return: byte[]
focal_class.signature: byte[] bigIntegerToBytes(BigInteger b, int numBytes)
focal_class.class_method_signature: Utils.toNanoCoins(String coins)
focal_class.full_signature: public static BigInteger toNanoCoins(String coins)
focal_class.identifier: toNanoCoins
focal_class.modifiers: public static
focal_class.parameters: (String coins)
focal_class.return: BigInteger
focal_class.signature: BigInteger toNanoCoins(String coins)
focal_class.class_method_signature: Utils.uint32ToByteArrayBE(long val, byte[] out, int offset)
focal_class.full_signature: public static void uint32ToByteArrayBE(long val, byte[] out, int offset)
focal_class.identifier: uint32ToByteArrayBE
focal_class.modifiers: public static
focal_class.parameters: (long val, byte[] out, int offset)
focal_class.return: void
focal_class.signature: void uint32ToByteArrayBE(long val, byte[] out, int offset)
focal_class.class_method_signature: Utils.uint32ToByteArrayLE(long val, byte[] out, int offset)
focal_class.full_signature: public static void uint32ToByteArrayLE(long val, byte[] out, int offset)
focal_class.identifier: uint32ToByteArrayLE
focal_class.modifiers: public static
focal_class.parameters: (long val, byte[] out, int offset)
focal_class.return: void
focal_class.signature: void uint32ToByteArrayLE(long val, byte[] out, int offset)
focal_class.class_method_signature: Utils.uint64ToByteArrayLE(long val, byte[] out, int offset)
focal_class.full_signature: public static void uint64ToByteArrayLE(long val, byte[] out, int offset)
focal_class.identifier: uint64ToByteArrayLE
focal_class.modifiers: public static
focal_class.parameters: (long val, byte[] out, int offset)
focal_class.return: void
focal_class.signature: void uint64ToByteArrayLE(long val, byte[] out, int offset)
focal_class.class_method_signature: Utils.uint32ToByteStreamLE(long val, OutputStream stream)
focal_class.full_signature: public static void uint32ToByteStreamLE(long val, OutputStream stream)
focal_class.identifier: uint32ToByteStreamLE
focal_class.modifiers: public static
focal_class.parameters: (long val, OutputStream stream)
focal_class.return: void
focal_class.signature: void uint32ToByteStreamLE(long val, OutputStream stream)
focal_class.class_method_signature: Utils.int64ToByteStreamLE(long val, OutputStream stream)
focal_class.full_signature: public static void int64ToByteStreamLE(long val, OutputStream stream)
focal_class.identifier: int64ToByteStreamLE
focal_class.modifiers: public static
focal_class.parameters: (long val, OutputStream stream)
focal_class.return: void
focal_class.signature: void int64ToByteStreamLE(long val, OutputStream stream)
focal_class.class_method_signature: Utils.uint64ToByteStreamLE(BigInteger val, OutputStream stream)
focal_class.full_signature: public static void uint64ToByteStreamLE(BigInteger val, OutputStream stream)
focal_class.identifier: uint64ToByteStreamLE
focal_class.modifiers: public static
focal_class.parameters: (BigInteger val, OutputStream stream)
focal_class.return: void
focal_class.signature: void uint64ToByteStreamLE(BigInteger val, OutputStream stream)
focal_class.class_method_signature: Utils.doubleDigest(byte[] input)
focal_class.full_signature: public static byte[] doubleDigest(byte[] input)
focal_class.identifier: doubleDigest
focal_class.modifiers: public static
focal_class.parameters: (byte[] input)
focal_class.return: byte[]
focal_class.signature: byte[] doubleDigest(byte[] input)
focal_class.class_method_signature: Utils.scryptDigest(byte[] input)
focal_class.full_signature: public static byte[] scryptDigest(byte[] input)
focal_class.identifier: scryptDigest
focal_class.modifiers: public static
focal_class.parameters: (byte[] input)
focal_class.return: byte[]
focal_class.signature: byte[] scryptDigest(byte[] input)
focal_class.class_method_signature: Utils.doubleDigest(byte[] input, int offset, int length)
focal_class.full_signature: public static byte[] doubleDigest(byte[] input, int offset, int length)
focal_class.identifier: doubleDigest
focal_class.modifiers: public static
focal_class.parameters: (byte[] input, int offset, int length)
focal_class.return: byte[]
focal_class.signature: byte[] doubleDigest(byte[] input, int offset, int length)
focal_class.class_method_signature: Utils.singleDigest(byte[] input, int offset, int length)
focal_class.full_signature: public static byte[] singleDigest(byte[] input, int offset, int length)
focal_class.identifier: singleDigest
focal_class.modifiers: public static
focal_class.parameters: (byte[] input, int offset, int length)
focal_class.return: byte[]
focal_class.signature: byte[] singleDigest(byte[] input, int offset, int length)
focal_class.class_method_signature: Utils.doubleDigestTwoBuffers(byte[] input1, int offset1, int length1,
                                                  byte[] input2, int offset2, int length2)
focal_class.full_signature: public static byte[] doubleDigestTwoBuffers(byte[] input1, int offset1, int length1,
                                                  byte[] input2, int offset2, int length2)
focal_class.identifier: doubleDigestTwoBuffers
focal_class.modifiers: public static
focal_class.parameters: (byte[] input1, int offset1, int length1,
                                                  byte[] input2, int offset2, int length2)
focal_class.return: byte[]
focal_class.signature: byte[] doubleDigestTwoBuffers(byte[] input1, int offset1, int length1,
                                                  byte[] input2, int offset2, int length2)
focal_class.class_method_signature: Utils.isLessThanUnsigned(long n1, long n2)
focal_class.full_signature: public static boolean isLessThanUnsigned(long n1, long n2)
focal_class.identifier: isLessThanUnsigned
focal_class.modifiers: public static
focal_class.parameters: (long n1, long n2)
focal_class.return: boolean
focal_class.signature: boolean isLessThanUnsigned(long n1, long n2)
focal_class.class_method_signature: Utils.bytesToHexString(byte[] bytes)
focal_class.full_signature: public static String bytesToHexString(byte[] bytes)
focal_class.identifier: bytesToHexString
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes)
focal_class.return: String
focal_class.signature: String bytesToHexString(byte[] bytes)
focal_class.class_method_signature: Utils.reverseBytes(byte[] bytes)
focal_class.full_signature: public static byte[] reverseBytes(byte[] bytes)
focal_class.identifier: reverseBytes
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes)
focal_class.return: byte[]
focal_class.signature: byte[] reverseBytes(byte[] bytes)
focal_class.class_method_signature: Utils.reverseDwordBytes(byte[] bytes, int trimLength)
focal_class.full_signature: public static byte[] reverseDwordBytes(byte[] bytes, int trimLength)
focal_class.identifier: reverseDwordBytes
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes, int trimLength)
focal_class.return: byte[]
focal_class.signature: byte[] reverseDwordBytes(byte[] bytes, int trimLength)
focal_class.class_method_signature: Utils.readUint32(byte[] bytes, int offset)
focal_class.full_signature: public static long readUint32(byte[] bytes, int offset)
focal_class.identifier: readUint32
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes, int offset)
focal_class.return: long
focal_class.signature: long readUint32(byte[] bytes, int offset)
focal_class.class_method_signature: Utils.readInt64(byte[] bytes, int offset)
focal_class.full_signature: public static long readInt64(byte[] bytes, int offset)
focal_class.identifier: readInt64
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes, int offset)
focal_class.return: long
focal_class.signature: long readInt64(byte[] bytes, int offset)
focal_class.class_method_signature: Utils.readUint32BE(byte[] bytes, int offset)
focal_class.full_signature: public static long readUint32BE(byte[] bytes, int offset)
focal_class.identifier: readUint32BE
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes, int offset)
focal_class.return: long
focal_class.signature: long readUint32BE(byte[] bytes, int offset)
focal_class.class_method_signature: Utils.readUint16BE(byte[] bytes, int offset)
focal_class.full_signature: public static int readUint16BE(byte[] bytes, int offset)
focal_class.identifier: readUint16BE
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes, int offset)
focal_class.return: int
focal_class.signature: int readUint16BE(byte[] bytes, int offset)
focal_class.class_method_signature: Utils.sha256hash160(byte[] input)
focal_class.full_signature: public static byte[] sha256hash160(byte[] input)
focal_class.identifier: sha256hash160
focal_class.modifiers: public static
focal_class.parameters: (byte[] input)
focal_class.return: byte[]
focal_class.signature: byte[] sha256hash160(byte[] input)
focal_class.class_method_signature: Utils.bitcoinValueToFriendlyString(BigInteger value)
focal_class.full_signature: public static String bitcoinValueToFriendlyString(BigInteger value)
focal_class.identifier: bitcoinValueToFriendlyString
focal_class.modifiers: public static
focal_class.parameters: (BigInteger value)
focal_class.return: String
focal_class.signature: String bitcoinValueToFriendlyString(BigInteger value)
focal_class.class_method_signature: Utils.bitcoinValueToPlainString(BigInteger value)
focal_class.full_signature: public static String bitcoinValueToPlainString(BigInteger value)
focal_class.identifier: bitcoinValueToPlainString
focal_class.modifiers: public static
focal_class.parameters: (BigInteger value)
focal_class.return: String
focal_class.signature: String bitcoinValueToPlainString(BigInteger value)
focal_class.class_method_signature: Utils.decodeMPI(byte[] mpi, boolean hasLength)
focal_class.full_signature: public static BigInteger decodeMPI(byte[] mpi, boolean hasLength)
focal_class.identifier: decodeMPI
focal_class.modifiers: public static
focal_class.parameters: (byte[] mpi, boolean hasLength)
focal_class.return: BigInteger
focal_class.signature: BigInteger decodeMPI(byte[] mpi, boolean hasLength)
focal_class.class_method_signature: Utils.encodeMPI(BigInteger value, boolean includeLength)
focal_class.full_signature: public static byte[] encodeMPI(BigInteger value, boolean includeLength)
focal_class.identifier: encodeMPI
focal_class.modifiers: public static
focal_class.parameters: (BigInteger value, boolean includeLength)
focal_class.return: byte[]
focal_class.signature: byte[] encodeMPI(BigInteger value, boolean includeLength)
focal_class.class_method_signature: Utils.decodeCompactBits(long compact)
focal_class.full_signature: public static BigInteger decodeCompactBits(long compact)
focal_class.identifier: decodeCompactBits
focal_class.modifiers: public static
focal_class.parameters: (long compact)
focal_class.return: BigInteger
focal_class.signature: BigInteger decodeCompactBits(long compact)
focal_class.class_method_signature: Utils.rollMockClock(int seconds)
focal_class.full_signature: public static Date rollMockClock(int seconds)
focal_class.identifier: rollMockClock
focal_class.modifiers: public static
focal_class.parameters: (int seconds)
focal_class.return: Date
focal_class.signature: Date rollMockClock(int seconds)
focal_class.class_method_signature: Utils.rollMockClockMillis(long millis)
focal_class.full_signature: public static Date rollMockClockMillis(long millis)
focal_class.identifier: rollMockClockMillis
focal_class.modifiers: public static
focal_class.parameters: (long millis)
focal_class.return: Date
focal_class.signature: Date rollMockClockMillis(long millis)
focal_class.class_method_signature: Utils.setMockClock(long mockClock)
focal_class.full_signature: public static void setMockClock(long mockClock)
focal_class.identifier: setMockClock
focal_class.modifiers: public static
focal_class.parameters: (long mockClock)
focal_class.return: void
focal_class.signature: void setMockClock(long mockClock)
focal_class.class_method_signature: Utils.now()
focal_class.full_signature: public static Date now()
focal_class.identifier: now
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Date
focal_class.signature: Date now()
focal_class.class_method_signature: Utils.currentTimeMillis()
focal_class.full_signature: public static long currentTimeMillis()
focal_class.identifier: currentTimeMillis
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long currentTimeMillis()
focal_class.class_method_signature: Utils.copyOf(byte[] in, int length)
focal_class.full_signature: public static byte[] copyOf(byte[] in, int length)
focal_class.identifier: copyOf
focal_class.modifiers: public static
focal_class.parameters: (byte[] in, int length)
focal_class.return: byte[]
focal_class.signature: byte[] copyOf(byte[] in, int length)
focal_class.class_method_signature: Utils.appendByte(byte[] bytes, byte b)
focal_class.full_signature: public static byte[] appendByte(byte[] bytes, byte b)
focal_class.identifier: appendByte
focal_class.modifiers: public static
focal_class.parameters: (byte[] bytes, byte b)
focal_class.return: byte[]
focal_class.signature: byte[] appendByte(byte[] bytes, byte b)
focal_class.class_method_signature: Utils.parseAsHexOrBase58(String data)
focal_class.full_signature: public static byte[] parseAsHexOrBase58(String data)
focal_class.identifier: parseAsHexOrBase58
focal_class.modifiers: public static
focal_class.parameters: (String data)
focal_class.return: byte[]
focal_class.signature: byte[] parseAsHexOrBase58(String data)
focal_class.class_method_signature: Utils.isWindows()
focal_class.full_signature: public static boolean isWindows()
focal_class.identifier: isWindows
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isWindows()
focal_class.class_method_signature: Utils.formatMessageForSigning(String message)
focal_class.full_signature: public static byte[] formatMessageForSigning(String message)
focal_class.identifier: formatMessageForSigning
focal_class.modifiers: public static
focal_class.parameters: (String message)
focal_class.return: byte[]
focal_class.signature: byte[] formatMessageForSigning(String message)
focal_class.class_method_signature: Utils.checkBitLE(byte[] data, int index)
focal_class.full_signature: public static boolean checkBitLE(byte[] data, int index)
focal_class.identifier: checkBitLE
focal_class.modifiers: public static
focal_class.parameters: (byte[] data, int index)
focal_class.return: boolean
focal_class.signature: boolean checkBitLE(byte[] data, int index)
focal_class.class_method_signature: Utils.setBitLE(byte[] data, int index)
focal_class.full_signature: public static void setBitLE(byte[] data, int index)
focal_class.identifier: setBitLE
focal_class.modifiers: public static
focal_class.parameters: (byte[] data, int index)
focal_class.return: void
focal_class.signature: void setBitLE(byte[] data, int index)
focal_class.class_method_signature: Utils.sleep(long millis)
focal_class.full_signature: public static void sleep(long millis)
focal_class.identifier: sleep
focal_class.modifiers: public static
focal_class.parameters: (long millis)
focal_class.return: void
focal_class.signature: void sleep(long millis)
focal_class.class_method_signature: Utils.setMockSleep(boolean isEnable)
focal_class.full_signature: public static void setMockSleep(boolean isEnable)
focal_class.identifier: setMockSleep
focal_class.modifiers: public static
focal_class.parameters: (boolean isEnable)
focal_class.return: void
focal_class.signature: void setMockSleep(boolean isEnable)
focal_class.class_method_signature: Utils.passMockSleep()
focal_class.full_signature: public static void passMockSleep()
focal_class.identifier: passMockSleep
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void passMockSleep()
focal_class.class_method_signature: Utils.finishMockSleep()
focal_class.full_signature: public static void finishMockSleep()
focal_class.identifier: finishMockSleep
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void finishMockSleep()
focal_method.body: public static String bitcoinValueToPlainString(BigInteger value) {
          if (value == null) {
              throw new IllegalArgumentException("Value cannot be null");
          }
                  
          BigDecimal valueInBTC = new BigDecimal(value).divide(new BigDecimal(Utils.COIN));
          return valueInBTC.toPlainString();
      }
focal_method.class_method_signature: Utils.bitcoinValueToPlainString(BigInteger value)
focal_method.full_signature: public static String bitcoinValueToPlainString(BigInteger value)
focal_method.identifier: bitcoinValueToPlainString
focal_method.invocations: divide toPlainString
focal_method.modifiers: public static
focal_method.parameters: (BigInteger value)
focal_method.return: String
focal_method.signature: String bitcoinValueToPlainString(BigInteger value)