Java Utililty Methods Integer Truncate

List of utility methods to do Integer Truncate

Description

The list of methods to do Integer Truncate are organized into topic(s).

Method

int[]truncate(int a, int b)
truncate
int quo = a / b;
return new int[] { quo, a - (quo * b) };
Stringtruncate(int n, int smallestDigit, int biggestDigit)
This returns a string from decimal digit smallestDigit to decimal digit biggest digit.
int numDigits = biggestDigit - smallestDigit + 1;
char[] result = new char[numDigits];
for (int j = 1; j < smallestDigit; j++) {
    n = n / 10;
for (int j = numDigits - 1; j >= 0; j--) {
    result[j] = Character.forDigit(n % 10, 10);
    n = n / 10;
...
inttruncate(int z, int base, int max)
truncate
if (z + base > max) {
    return max - z;
} else {
    return z;