Here you can find the source of swapInt(byte[] b, int i)
Parameter | Description |
---|---|
b | a parameter |
i | a parameter |
public static int swapInt(byte[] b, int i)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w. j ava2s . c om*/ * @param b * @param i * @return */ public static int swapInt(byte[] b, int i) { return Integer.reverseBytes(bytesToInt(b, i)); } private static int bytesToInt(byte[] b, int i) { return ((((b[i + 3]) & 0xff) << 0) | (((b[i + 2]) & 0xff) << 8) | (((b[i + 1]) & 0xff) << 16) | (((b[i + 0]) & 0xff) << 24)); } }