Package org.atlanmod.commons.primitive
Class Booleans
- java.lang.Object
-
- org.atlanmod.commons.primitive.Booleans
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]toBytes(boolean value)Encodes abooleanto abytearray.static byte[]toBytes(Boolean value)Encodes aBooleanto abytearray.static inttoInt(boolean value)Returns the integer value of a booleanvalue.
-
-
-
Method Detail
-
toBytes
@Nonnull public static byte[] toBytes(boolean value)
Encodes abooleanto abytearray.- Parameters:
value- the value to encode- Returns:
- a
bytearray
-
toBytes
@Nonnull public static byte[] toBytes(Boolean value)
Encodes aBooleanto abytearray.- Parameters:
value- the value to encode- Returns:
- a
bytearray - Throws:
NullPointerException- if thevalueisnull
-
toInt
@Nonnegative public static int toInt(boolean value)
Returns the integer value of a booleanvalue. In other words, returns1whenvalue == true,0otherwise.- Parameters:
value- the boolean value- Returns:
- an
int
-
-