fromByte

fun fromByte(number: Byte): Zero

Creates an instance of Zero from the specified number, or throws an IllegalArgumentException if the number is other than zero.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val number: Byte = 0
val isSuccess: Boolean = try {
Zero.fromByte(number)
true
} catch (exception: IllegalArgumentException) {
false
}
println(isSuccess) // true

Calling from Java

Here's an example of calling this function from Java code:

final byte number = 0;
boolean isSuccess;
try {
Zero.fromByte(number);
isSuccess = true;
} catch (final IllegalArgumentException exception) {
isSuccess = false;
}
System.out.println(isSuccess); // true