toString
Returns the decimal string representation of this integer, delegating to Integer.toString.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val value: Integer = Integer.fromLong(42)
val nonNegativeInteger: NonNegativeInteger =
NonNegativeInteger.fromInteger(value)
val result: String = nonNegativeInteger.toString()
check(result == "42")Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final Integer value = Integer.fromLong(42);
final NonNegativeInteger nonNegativeInteger =
NonNegativeInteger.fromInteger(value);
final String result = String.valueOf(nonNegativeInteger);
final boolean check = result.equals("42");
if (!check) throw new IllegalStateException("Check failed.");Content copied to clipboard