Java Convert via ByteBuffer longToHeight(long x)

Here you can find the source of longToHeight(long x)

Description

long To Height

License

MIT License

Declaration

public static int longToHeight(long x) 

Method Source Code

//package com.java2s;
/*//from  w  w  w  .j  a v a 2 s. c o m
 * Copyright (c) 2014 CIYAM Developers

 Distributed under the MIT/X11 software license, please refer to the file license.txt
 in the root project directory or http://www.opensource.org/licenses/mit-license.php.

 */

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static int longToHeight(long x) {
        ByteBuffer buffer = ByteBuffer.allocate(8);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        buffer.putLong(0, x);
        return buffer.getInt(4);
    }
}

Related

  1. longToBytes(long l, int size)
  2. longToBytes(long x)
  3. longToBytes(long x, byte[] dest, int offset)
  4. longToBytesNoLeadZeroes(long val)
  5. longToFourBytesFlip(long l)
  6. longToIPv4(Long ip)
  7. longToLE(long lVal)
  8. longToShorts2(long value)
  9. shortToByteArray(short inShort)