Java Byte Array to Int bytes2LengthToIntLowOrder(byte[] intBytes)

Here you can find the source of bytes2LengthToIntLowOrder(byte[] intBytes)

Description

bytes Length To Int Low Order

License

Open Source License

Declaration

public static int bytes2LengthToIntLowOrder(byte[] intBytes) 

Method Source Code

//package com.java2s;
/*/*from   www.j a  v a 2 s .  c om*/
 * @(#)ByteConvertUtil.java   V0.0.1 2015-2-3, ????1:37:07
 *
 * Copyright 2015 www.ifood517.com. All rights reserved.
 * www.ifood517.com PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

public class Main {

    public static int bytes2LengthToIntLowOrder(byte[] intBytes) {
        byte[] data = new byte[2];
        System.arraycopy(intBytes, 0, data, 0, 2);
        return (int) ((0 & 0xff) << 24) | ((0 & 0xff) << 16) | ((data[1] & 0xff) << 8) | ((data[0] & 0xff) << 0);
    }

    public static int bytes2LengthToIntLowOrder(byte[] intBytes, int index) {
        byte[] data = new byte[2];
        System.arraycopy(intBytes, index, data, 0, 2);
        return (int) ((0 & 0xff) << 24) | ((0 & 0xff) << 16) | ((data[1] & 0xff) << 8) | ((data[0] & 0xff) << 0);
    }
}

Related

  1. Bytes2Int16(byte[] sour, int offset)
  2. Bytes2Int32(byte[] sour, int offset)
  3. Bytes2Int64(byte[] sour, int offset)
  4. bytes2IntArray(byte[] bytes)
  5. bytes2Integer(byte[] byteVal)
  6. bytes2ToInt(byte[] inputValues)
  7. Bytes2Uint32(byte[] sour, int offset)
  8. bytesToInt(byte a)
  9. bytesToInt(byte A, byte B, byte C, byte D)