Java Byte Array to Endian bytesToXBigEndian(byte[] in, int offset, int size)

Here you can find the source of bytesToXBigEndian(byte[] in, int offset, int size)

Description

bytes To X Big Endian

License

Open Source License

Declaration

public static long bytesToXBigEndian(byte[] in, int offset, int size) 

Method Source Code

//package com.java2s;

public class Main {
    public static long bytesToXBigEndian(byte[] in, int offset, int size) {
        if (in == null) {
            throw new NullPointerException("in == null");
        }//  w  ww  . j  ava2 s.co  m
        long res = 0;
        for (int i = offset; i < (offset + size); i++) {
            res = (res << 8) | (in[i] & 0xff);
        }
        return res;
    }
}

Related

  1. bytesToIntBigEndian(byte[] buf)
  2. bytesToIntLE(byte[] bytes, int offset, int length)
  3. bytesToLongLittleEndian(final byte[] vals, final int from)
  4. bytesToNumberLittleEndian(byte[] buffer, int start, int length)
  5. bytesToTag(byte[] bytes, int off, boolean bigEndian)