public class BitUtil extends Object
Constructor and Description |
---|
BitUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
countBitValue(int maxTurnCosts) |
byte[] |
fromBitString(String str) |
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) |
void |
fromInt(byte[] bytes,
int value,
int offset) |
byte[] |
fromInt(int value) |
void |
fromLong(byte[] bytes,
long value) |
void |
fromLong(byte[] bytes,
long value,
int offset) |
byte[] |
fromLong(long value) |
void |
fromShort(byte[] bytes,
short value) |
void |
fromShort(byte[] bytes,
short value,
int offset) |
byte[] |
fromShort(short value) |
int |
getIntHigh(long longValue) |
int |
getIntLow(long longValue) |
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) |
int |
toInt(byte[] b,
int offset) |
String |
toLastBitString(long value,
int bits) |
long |
toLong(byte[] b)
See the counterpart
fromLong(long) |
long |
toLong(byte[] b,
int offset) |
long |
toLong(int intLow,
int intHigh) |
short |
toShort(byte[] b) |
short |
toShort(byte[] b,
int offset) |
static int |
toSignedInt(long x)
Converts the specified long back into a signed int (reverse method for toUnsignedLong)
|
static long |
toUnsignedLong(int x)
This method handles the specified (potentially negative) int as unsigned bit representation
and returns the positive converted long.
|
public static final BitUtil LITTLE
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 final short toShort(byte[] b, int offset)
public final int toInt(byte[] b)
public final 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 void fromShort(byte[] bytes, short value, int offset)
public final void fromInt(byte[] bytes, int value, int offset)
public final long toLong(byte[] b)
fromLong(long)
public final long toLong(int intLow, int intHigh)
public final long toLong(byte[] b, int offset)
public final byte[] fromLong(long value)
public final void fromLong(byte[] bytes, long value)
public final void fromLong(byte[] bytes, long value, int offset)
public 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 String toBitString(byte[] bytes)
public final int getIntLow(long longValue)
public final int getIntHigh(long longValue)
public static int countBitValue(int maxTurnCosts)
public static long toUnsignedLong(int x)
public static int toSignedInt(long x)
Copyright © 2012–2023. All rights reserved.