在 Java 中从字节数组创建 BigInteger
BigInteger 类提供了用于算术模运算、最大公约数计算、质数测试、质数生成、位操作和其他一些杂项运算的操作。
假设以下内容是我们的字节数组 -
byte[] arr = new byte[] { 0x1, 0x00, 0x00 };我们现在将它们转换为 BigInteger -
BigInteger bInteger = new BigInteger(arr);
以下是一个示例,其中在 Java 中从字节数组创建 BigInteger。
示例
import java.math.BigInteger;
public class Demo {
public static void main(String[] argv) throws Exception {
byte[] arr = new byte[] { 0x1, 0x00, 0x00 };
BigInteger bInteger = new BigInteger(arr);
System.out.println(bInteger);
}
}输出
65536
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程语言
C++
C#
MongoDB
MySQL
Javascript
PHP