divOrNull
Returns the quotient of dividing this integer by the other one, or returns null if the other integer is zero.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
// Given
val x: Integer = Integer.fromDecimal("922337203685477580700")
val y: Integer = Integer.from(10)
// When
val result: Integer? = x.divOrNull(y)
// Then
val expected: Integer = Integer.fromDecimal("92233720368547758070")
check(result == expected)Content copied to clipboard
This function is not available from Java code, due to its non-explicit support for nullable types.
See the div function for throwing an exception instead of returning null in case of invalid other integer.