toString

override fun toString(): String

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 nonPositiveInteger: NonPositiveInteger =
NonPositiveInteger.fromInteger(value)
val result: String = nonPositiveInteger.toString()
check(result == "-42")

Calling from Java

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

final Integer value = Integer.fromLong(-42);
final NonPositiveInteger nonPositiveInteger =
NonPositiveInteger.fromInteger(value);
final String result = String.valueOf(nonPositiveInteger);
final boolean check = result.equals("-42");
if (!check) throw new IllegalStateException("Check failed.");