create
Creates a NegativeInt from the specified number, which may involve rounding or truncation, or throws an IllegalArgumentException if the number is greater than zero.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val number: NegativeInt = NegativeInt.create(-7)
println(number) // -7Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final NegativeInt number = NegativeInt.Companion.create(-7);
System.out.println(number); // -7Content copied to clipboard
You can use the NegativeInt.Companion.createOrNull function for returning null instead of throwing an exception in case of invalid number.