Java ByteBuffer Decode decodeLong(ByteBuffer buffer, int start)

Here you can find the source of decodeLong(ByteBuffer buffer, int start)

Description

decode Long

License

Apache License

Declaration

public static long decodeLong(ByteBuffer buffer, int start) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    public static long decodeLong(byte[] value, int start) {
        int highword = ((value[start] & 0xFF) << 24) + ((value[start + 1] & 0xFF) << 16)
                + ((value[start + 2] & 0xFF) << 8) + (value[start + 3] & 0xFF);
        int lowword = ((value[start + 4] & 0xFF) << 24) + ((value[start + 5] & 0xFF) << 16)
                + ((value[start + 6] & 0xFF) << 8) + (value[start + 7] & 0xFF);
        return ((long) highword << 32) + (lowword & 0xFFFFFFFFL);
    }/*from   w w  w  .j  a  va2  s  .c o  m*/

    public static long decodeLong(ByteBuffer buffer, int start) {
        return buffer.getLong(start);
    }
}

Related

  1. decodeBuffer(ByteBuffer buffer, String charsetName)
  2. decodeDouble(ByteBuffer bb)
  3. decodeInt(ByteBuffer buffer, int start)
  4. decodeIO(String encoding, ByteBuffer bbuf)
  5. decodeLength(ByteBuffer buf)
  6. decodeNIO(String encoding, ByteBuffer bbuf)
  7. decodeNumber(byte firstByte, ByteBuffer buffer)
  8. decodeStoredBits(ByteBuffer bb)
  9. decodeStringSequence(ByteBuffer bb)