1. 程式人生 > >java 大端和小端轉換

java 大端和小端轉換

1.把小端資料轉換成int

int i = ByteBuffer.wrap(fourBytes).order(ByteOrder.LITTLE_ENDIAN).getInt();

2.把大端資料轉換成int

int j = ByteBuffer.wrap(fourBytes).order(ByteOrder.BIG_ENDIAN).getInt();