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 nonZeroInteger: NonZeroInteger = NonZeroInteger.fromInteger(value)
val result: String = nonZeroInteger.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 NonZeroInteger nonZeroInteger = NonZeroInteger.fromInteger(value);
final String result = String.valueOf(nonZeroInteger);
final boolean check = result.equals("-42");
if (!check) throw new IllegalStateException("Check failed.");Content copied to clipboard