Class BitUtil

java.lang.Object
com.graphhopper.util.BitUtil

public class BitUtil extends Object
LITTLE endianness is default for GraphHopper and most microprocessors.
Author:
Peter Karich
  • Field Details

    • LITTLE

      public static final BitUtil LITTLE
  • Constructor Details

    • BitUtil

      public BitUtil()
  • Method Details

    • toDouble

      public final double toDouble(byte[] bytes)
    • toDouble

      public final double toDouble(byte[] bytes, int offset)
    • fromDouble

      public final byte[] fromDouble(double value)
    • fromDouble

      public final void fromDouble(byte[] bytes, double value)
    • fromDouble

      public final void fromDouble(byte[] bytes, double value, int offset)
    • toFloat

      public final float toFloat(byte[] bytes)
    • toFloat

      public final float toFloat(byte[] bytes, int offset)
    • fromFloat

      public final byte[] fromFloat(float value)
    • fromFloat

      public final void fromFloat(byte[] bytes, float value)
    • fromFloat

      public final void fromFloat(byte[] bytes, float value, int offset)
    • toShort

      public final short toShort(byte[] b)
    • toShort

      public final short toShort(byte[] b, int offset)
    • toInt

      public final int toInt(byte[] b)
    • toInt

      public final int toInt(byte[] b, int offset)
    • fromInt

      public final byte[] fromInt(int value)
    • fromInt

      public final void fromInt(byte[] bytes, int value)
    • fromShort

      public final byte[] fromShort(short value)
    • fromShort

      public final void fromShort(byte[] bytes, short value)
    • fromShort

      public void fromShort(byte[] bytes, short value, int offset)
    • fromInt

      public final void fromInt(byte[] bytes, int value, int offset)
    • toLong

      public final long toLong(byte[] b)
      See the counterpart fromLong(long)
    • toLong

      public final long toLong(int intLow, int intHigh)
    • toLong

      public final long toLong(byte[] b, int offset)
    • fromLong

      public final byte[] fromLong(long value)
    • fromLong

      public final void fromLong(byte[] bytes, long value)
    • fromLong

      public final void fromLong(byte[] bytes, long value, int offset)
    • fromBitString

      public byte[] fromBitString(String str)
    • toBitString

      public final String toBitString(IntsRef intsRef)
    • toBitString

      public final String toBitString(long value)
      Similar to Long.toBinaryString
    • toLastBitString

      public String toLastBitString(long value, int bits)
    • toBitString

      public String toBitString(long value, int bits)
      Higher order bits comes first in the returned string.

      Parameters:
      bits - how many bits should be returned.
    • toBitString

      public String toBitString(byte[] bytes)
      Higher order bits comes first in the returned string.
    • getIntLow

      public final int getIntLow(long longValue)
    • getIntHigh

      public final int getIntHigh(long longValue)
    • countBitValue

      public static int countBitValue(int maxTurnCosts)
    • toSignedInt

      public static int toSignedInt(long x)
      Converts the specified long into a signed int ('reverse' method for Integer.toUnsignedLong).