本文整理汇总了Java中org.web3j.utils.Numeric.toBigInt方法的典型用法代码示例。如果您正苦于以下问题:Java Numeric.toBigInt方法的具体用法?Java Numeric.toBigInt怎么用?Java Numeric.toBigInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.web3j.utils.Numeric
的用法示例。
在下文中一共展示了Numeric.toBigInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeKeyPair
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
public static KeyPair decodeKeyPair(ECKeyPair ecKeyPair) {
byte[] bytes = Numeric.toBytesPadded(ecKeyPair.getPublicKey(), 64);
BigInteger x = Numeric.toBigInt(Arrays.copyOfRange(bytes, 0, 32));
BigInteger y = Numeric.toBigInt(Arrays.copyOfRange(bytes, 32, 64));
ECPoint q = curve.createPoint(x, y);
BCECPublicKey publicKey = new BCECPublicKey(ALGORITHM, new ECPublicKeyParameters(q, dp), BouncyCastleProvider.CONFIGURATION);
BCECPrivateKey privateKey = new BCECPrivateKey(ALGORITHM, new ECPrivateKeyParameters(ecKeyPair.getPrivateKey(), dp), publicKey, p, BouncyCastleProvider.CONFIGURATION);
return new KeyPair(publicKey, privateKey);
}
示例2: deserialize
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
public static ECKeyPair deserialize(byte[] input) {
if (input.length != PRIVATE_KEY_SIZE + PUBLIC_KEY_SIZE) {
throw new RuntimeException("Invalid input key size");
}
BigInteger privateKey = Numeric.toBigInt(input, 0, PRIVATE_KEY_SIZE);
BigInteger publicKey = Numeric.toBigInt(input, PRIVATE_KEY_SIZE, PUBLIC_KEY_SIZE);
return new ECKeyPair(privateKey, publicKey);
}
示例3: deserialize
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
@Override
public Uint256 deserialize(ByteBuffer bytes, ProtocolVersion protocolVersion) throws InvalidTypeException {
if (bytes == null) return null;
return new Uint256(Numeric.toBigInt(bytes.array(), 0, BYTES));
}
示例4: parse
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
@Override
public Uint256 parse(String value) throws InvalidTypeException {
return new Uint256(Numeric.toBigInt(value));
}
示例5: deserialize
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
@Override
public Address deserialize(ByteBuffer bytes, ProtocolVersion protocolVersion) throws InvalidTypeException {
if (bytes == null) return null;
return new Address(Numeric.toBigInt(bytes.array(), 0, BYTES));
}
示例6: randomAddress
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
private Address randomAddress() {
byte[] bytes = new byte[20];
random.nextBytes(bytes);
return new Address(Numeric.toBigInt(bytes));
}
示例7: decodeBool
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
static Bool decodeBool(String rawInput, int offset) {
String input = rawInput.substring(offset, offset + MAX_BYTE_LENGTH_FOR_HEX_STRING);
BigInteger numericValue = Numeric.toBigInt(input);
boolean value = numericValue.equals(BigInteger.ONE);
return new Bool(value);
}
示例8: Address
import org.web3j.utils.Numeric; //导入方法依赖的package包/类
public Address(String hexValue) {
this(Numeric.toBigInt(hexValue));
}