本文整理了Java中org.web3j.utils.Numeric.toHexStringNoPrefixZeroPadded()
方法的一些代码示例,展示了Numeric.toHexStringNoPrefixZeroPadded()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Numeric.toHexStringNoPrefixZeroPadded()
方法的具体详情如下:
包路径:org.web3j.utils.Numeric
类名称:Numeric
方法名:toHexStringNoPrefixZeroPadded
暂无
代码示例来源:origin: web3j/web3j
@Test
public void testToHexStringNoPrefixZeroPadded() {
assertThat(
Numeric.toHexStringNoPrefixZeroPadded(
BigInteger.ZERO,
5),
is("00000"));
assertThat(
Numeric.toHexStringNoPrefixZeroPadded(
new BigInteger("11c52b08330e05d731e38c856c1043288f7d9744", 16),
40),
is("11c52b08330e05d731e38c856c1043288f7d9744"));
assertThat(
Numeric.toHexStringNoPrefixZeroPadded(
new BigInteger("01c52b08330e05d731e38c856c1043288f7d9744", 16),
40),
is("01c52b08330e05d731e38c856c1043288f7d9744"));
}
代码示例来源:origin: web3j/web3j
@Test(expected = UnsupportedOperationException.class)
public void testToHexStringZeroPaddedNegative() {
Numeric.toHexStringNoPrefixZeroPadded(BigInteger.valueOf(-1), 20);
}
代码示例来源:origin: web3j/web3j
@Test(expected = UnsupportedOperationException.class)
public void testToHexStringZeroPaddedTooLargs() {
Numeric.toHexStringNoPrefixZeroPadded(BigInteger.valueOf(-1), 5);
}
代码示例来源:origin: web3j/web3j
private void assertCorrectEntropy(String expected, String mnemonic, int size) {
Assert.assertEquals(expected, Numeric.toHexStringNoPrefixZeroPadded(
Numeric.toBigInt(MnemonicUtils.generateEntropy(mnemonic)), size));
}
}
代码示例来源:origin: uncleleonfan/FunWallet
public String exportPrivateKey(WalletFile wallet) {
try {
ECKeyPair ecKeyPair = Wallet.decrypt(PASSWORD, wallet);
BigInteger privateKey = ecKeyPair.getPrivateKey();
return Numeric.toHexStringNoPrefixZeroPadded(privateKey, Keys.PRIVATE_KEY_LENGTH_IN_HEX);
} catch (CipherException e) {
e.printStackTrace();
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!