public class BitTools extends Object
| Constructor and Description |
|---|
BitTools() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
getAndCopyBit(long[] src,
int posBit,
long[] dst) |
static boolean |
getBit(long[] ba,
int posBit) |
static boolean |
getBit(long l,
int posBit) |
static long |
merge(long[] srcV,
int src1,
int src2,
int nBits)
Merges two long values into a single value by interleaving there respective bits.
|
static long[] |
mergeLong(int nBitsPerValue,
long[] src)
Merges long values into a single value by interleaving there respective bits.
|
static long |
reverse(long l,
int usedBits)
Reverses the value, considering that not all 64bits of the long value are used.
|
static long |
set0(long ba,
int posBit) |
static long |
set1(long ba,
int posBit) |
static void |
setBit(long[] ba,
int posBit,
boolean b) |
static long |
setBit(long ba,
int posBit,
boolean b) |
static void |
split(long toSplit,
long[] trgV,
int trg1,
int trg2,
int nBits)
Splits a value and write it to trgV at position trg1 and trg2.
|
static long[] |
splitLong(int dims,
int nBitsPerValue,
long[] toSplit)
Splits a value and write it to trgV at position trg1 and trg2.
|
static String |
toBinary(long[] la,
int DEPTH) |
static String |
toBinary(long l,
int DEPTH) |
static double |
toDouble(long value) |
static double[] |
toDouble(long[] value,
double[] ret) |
static float |
toFloat(long value) |
static float[] |
toFloat(long[] value,
float[] ret) |
static long |
toSortableLong(double value) |
static long[] |
toSortableLong(double[] value,
long[] ret) |
static long |
toSortableLong(float value) |
static long[] |
toSortableLong(float[] value,
long[] ret) |
static long |
toSortableLong(String s) |
public static long toSortableLong(double value)
value - value to convertpublic static long toSortableLong(float value)
public static double toDouble(long value)
public static float toFloat(long value)
public static long[] toSortableLong(double[] value,
long[] ret)
value - ret - The array used to store the return valuepublic static long[] toSortableLong(float[] value,
long[] ret)
public static double[] toDouble(long[] value,
double[] ret)
public static float[] toFloat(long[] value,
float[] ret)
public static long toSortableLong(String s)
public static long reverse(long l,
int usedBits)
l - usedBits - public static void split(long toSplit,
long[] trgV,
int trg1,
int trg2,
int nBits)
toSplit - value to splittrgV - return valuetrg1 - return position part 1trg2 - return position part 2nBits - Number of bits of source valuepublic static long merge(long[] srcV,
int src1,
int src2,
int nBits)
srcV - Source arraysrc1 - Position of 1st source valuesrc2 - Position of 2nd source valuenBits - Number of bits of RESULTpublic static long[] mergeLong(int nBitsPerValue,
long[] src)
src - Source arraynBitsPerValue - Number of bits of each source valuepublic static long[] splitLong(int dims,
int nBitsPerValue,
long[] toSplit)
dims - number of splinters to split intotoSplit - value to splitnBitsPerValue - Number of bits of source valuepublic static boolean getBit(long[] ba,
int posBit)
ba - byte arrayposBit - Counts from left to right!!!public static boolean getBit(long l,
int posBit)
l - bit setposBit - Counts from left to right!!!public static boolean getAndCopyBit(long[] src,
int posBit,
long[] dst)
src - source array
Reads a bit from src, writes it to dst and returns it.posBit - Counts from left to rightdst - target arraypublic static void setBit(long[] ba,
int posBit,
boolean b)
ba - byte arrayposBit - Counts from left to right (highest to lowest)!!!b - bit to setpublic static long setBit(long ba,
int posBit,
boolean b)
public static long set1(long ba,
int posBit)
public static long set0(long ba,
int posBit)
public static String toBinary(long[] la, int DEPTH)
public static String toBinary(long l, int DEPTH)
Copyright © 2017. All rights reserved.