public abstract class BitUtil extends Object
0=>0100 0001 1=>1110 1011 2=>...LITTLE endianness is default for GraphHopper and most microprocessors.
Modifier and Type | Field and Description |
---|---|
static BitUtil |
BIG
BIG endianness.
|
static BitUtil |
LITTLE
Default for GraphHopper
|
Constructor and Description |
---|
BitUtil() |
Modifier and Type | Method and Description |
---|---|
long |
combineIntsToLong(int intLow,
int intHigh) |
abstract byte[] |
fromBitString(String str) |
long |
fromBitString2Long(String str)
The only purpose of this method is to test 'reverse'.
|
void |
fromDouble(byte[] bytes,
double value) |
void |
fromDouble(byte[] bytes,
double value,
int offset) |
byte[] |
fromDouble(double value) |
void |
fromFloat(byte[] bytes,
float value) |
void |
fromFloat(byte[] bytes,
float value,
int offset) |
byte[] |
fromFloat(float value) |
void |
fromInt(byte[] bytes,
int value) |
abstract void |
fromInt(byte[] bytes,
int value,
int offset) |
byte[] |
fromInt(int value) |
void |
fromLong(byte[] bytes,
long value) |
abstract void |
fromLong(byte[] bytes,
long value,
int offset) |
byte[] |
fromLong(long value) |
void |
fromShort(byte[] bytes,
short value) |
abstract void |
fromShort(byte[] bytes,
short value,
int offset) |
byte[] |
fromShort(short value) |
static BitUtil |
get(ByteOrder order) |
int |
getIntHigh(long longValue) |
int |
getIntLow(long longValue) |
long |
reverse(long value,
int maxBits)
Reverses the bits in the specified long value and it removes the remaining higher bits.
|
long |
reverseLeft(long value,
int maxBits) |
abstract String |
toBitString(byte[] bytes)
Higher order bits comes first in the returned string.
|
String |
toBitString(IntsRef intsRef) |
String |
toBitString(long value)
Similar to Long.toBinaryString
|
String |
toBitString(long value,
int bits)
Higher order bits comes first in the returned string.
|
double |
toDouble(byte[] bytes) |
double |
toDouble(byte[] bytes,
int offset) |
float |
toFloat(byte[] bytes) |
float |
toFloat(byte[] bytes,
int offset) |
int |
toInt(byte[] b) |
abstract int |
toInt(byte[] b,
int offset) |
String |
toLastBitString(long value,
int bits) |
long |
toLong(byte[] b) |
abstract long |
toLong(byte[] b,
int offset) |
abstract long |
toLong(int high,
int low) |
short |
toShort(byte[] b) |
abstract short |
toShort(byte[] b,
int offset) |
public static final BitUtil LITTLE
public static final BitUtil BIG
public final double toDouble(byte[] bytes)
public final double toDouble(byte[] bytes, int offset)
public final byte[] fromDouble(double value)
public final void fromDouble(byte[] bytes, double value)
public final void fromDouble(byte[] bytes, double value, int offset)
public final float toFloat(byte[] bytes)
public final float toFloat(byte[] bytes, int offset)
public final byte[] fromFloat(float value)
public final void fromFloat(byte[] bytes, float value)
public final void fromFloat(byte[] bytes, float value, int offset)
public final short toShort(byte[] b)
public abstract short toShort(byte[] b, int offset)
public final int toInt(byte[] b)
public abstract int toInt(byte[] b, int offset)
public final byte[] fromInt(int value)
public final void fromInt(byte[] bytes, int value)
public final byte[] fromShort(short value)
public final void fromShort(byte[] bytes, short value)
public abstract void fromShort(byte[] bytes, short value, int offset)
public abstract void fromInt(byte[] bytes, int value, int offset)
public final long toLong(byte[] b)
public abstract long toLong(int high, int low)
public abstract long toLong(byte[] b, int offset)
public final byte[] fromLong(long value)
public final void fromLong(byte[] bytes, long value)
public abstract void fromLong(byte[] bytes, long value, int offset)
public final long fromBitString2Long(String str)
public abstract byte[] fromBitString(String str)
public final String toBitString(long value)
public String toLastBitString(long value, int bits)
public String toBitString(long value, int bits)
bits
- how many bits should be returned.public abstract String toBitString(byte[] bytes)
public final long reverse(long value, int maxBits)
maxBits
- the maximum number of recognized bits for reversalpublic final int getIntLow(long longValue)
public final int getIntHigh(long longValue)
public final long combineIntsToLong(int intLow, int intHigh)
public final long reverseLeft(long value, int maxBits)
Copyright © 2012–2020. All rights reserved.