在 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