public class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
byteArrayFromBytes(int... bytes)
Return an array of bytes containing as elements this method's parameters.
|
static int |
compare(double v1,
double v2) |
static int |
compare(long v1,
long v2) |
static boolean |
equalsNullable(java.lang.Object o1,
java.lang.Object o2)
Return true if the two objects are equal, according to their equals method.
|
static long |
max(long v1,
long v2) |
static long |
min(long v1,
long v2) |
public static byte[] byteArrayFromBytes(int... bytes)
This method exists mostly to avoid casting problems populating a byte[] literals inline--casting issues caused by integer literals always being ints not bytes in Java (and thus requiring a byte cast--compile issue #1) and translated C# always treating hex literals as unsigned and not allowing ones > 127 to be cast to (signed) bytes (compile issue #2). Anyway, that's all avoided just by passing in ints here.
bytes
- 0 or more bytes to convert into an array of bytespublic static int compare(long v1, long v2)
public static int compare(double v1, double v2)
public static long min(long v1, long v2)
public static long max(long v1, long v2)
public static boolean equalsNullable(@Nullable java.lang.Object o1, @Nullable java.lang.Object o2)
o1
- object 1o2
- object 2