|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.util.math.BitUtils
public class BitUtils
Method Summary | |
---|---|
static byte
|
reverseBitSignificance(byte b)
reverses the bits in a byte, i.e. 128 = 0b1000000 = bit list {0,0,0,0,0,0,0,1}, reversed yields 1 = 0b00000001 = bit list {1,0,0,0,0,0,0,0} |
static byte[]
|
reverseBitSignificance(byte... bytes)
returns an array of bytes where the bits in each byte have been reversed; note however the order of the arguments is not reversed; useful e.g. in working with IP address CIDR's |
static byte
|
reverseBitSignificanceInByte(int b)
as reverseBitSignificance(byte) but accepting int for convenience |
static byte[]
|
reverseBitSignificanceInBytes(int... bytes)
as reverseBitSignificance(byte...), but taking ints for convenience (ignoring high bits) |
static int
|
unsigned(byte b)
why oh why are bytes signed! |
static int
|
unsignedByte(int b)
returns the value in 0..255 which is equivalent mod 256 |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Method Detail |
---|
public static byte reverseBitSignificance(byte b)
public static byte[] reverseBitSignificance(byte... bytes)
public static byte reverseBitSignificanceInByte(int b)
public static byte[] reverseBitSignificanceInBytes(int... bytes)
public static int unsigned(byte b)
public static int unsignedByte(int b)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.