標籤:
- package com.yl.common.utils;
class ByteUtil {
- * 將iSource轉為長度為iArrayLen的byte數組,位元組數組的低位是整型的低位元組位
static byte[] toByteArray(int iSource, int iArrayLen) {
[] bLocalArr = new byte[iArrayLen];
(int i = 0; (i < 4) && (i < iArrayLen); i++) {
) (iSource >> 8 * i & 0xFF);
bLocalArr;
- * 將byte數組bRefArr轉為一個整數,位元組數組的低位是整型的低位元組位
static int toInt(byte[] bRefArr) {
iOutcome = 0;
bLoop;
(int i = 0; i < 4; i++) {
- bLoop = bRefArr[i];
- iOutcome += (bLoop & 0xFF
) << (8 * i);
iOutcome;
com.yl.common.utils;
class ByteUtil {
- * 將iSource轉為長度為iArrayLen的byte數組,位元組數組的低位是整型的低位元組位
static byte[] toByteArray(int iSource, int iArrayLen) {
[] bLocalArr = new byte[iArrayLen];
(int i = 0; (i < 4) && (i < iArrayLen); i++) {
) (iSource >> 8 * i & 0xFF);
bLocalArr;
- * 將byte數組bRefArr轉為一個整數,位元組數組的低位是整型的低位元組位
static int toInt(byte[] bRefArr) {
iOutcome = 0;
bLoop;
(int i = 0; i < 4; i++) {
- bLoop = bRefArr[i];
- iOutcome += (bLoop & 0xFF
) << (8 * i);
iOutcome;
原文地址 http://techfoxbbs.com/blog-1-5.html
java中byte與int互轉