Java Utililty Methods Double to Int

List of utility methods to do Double to Int

Description

The list of methods to do Double to Int are organized into topic(s).

Method

intdoubleToInt(double d, boolean floor)
double To Int
if (floor) {
    if (Math.ceil(d) - d < MAKE_SENSE_THRESHOLD) {
        return (int) Math.ceil(d);
    } else {
        return (int) Math.floor(d);
} else {
    if (d - Math.floor(d) < MAKE_SENSE_THRESHOLD) {
...
intdoubleToInt(double d, int defaultValue)
double To Int
if (d >= Integer.MIN_VALUE && d <= Integer.MAX_VALUE) {
    return (int) d;
return defaultValue;
intdoubleToInt(double dble)
double To Int
return (int) dble;
intdoubleToInt(double deg)
Converts a double (maximum value 10000) into an integer.
return (int) (deg * INT_FACTOR);
int[]doubleToInt(double[] doubles)
double To Int
int size = doubles.length;
int[] valorInt = new int[size];
for (int i = 0; i < size; i++) {
    valorInt[i] = (int) doubles[i];
return valorInt;
int[]doubleToInt(double[] values)
double To Int
if (values == null) {
    return null;
int[] results = new int[values.length];
for (int i = 0; i < values.length; i++) {
    results[i] = (int) values[i];
return results;
...
int[][]doubleToInt(double[][] array)
double To Int
int[][] output = new int[array.length][array[0].length];
for (int r = 0; r < array.length; r++)
    for (int c = 0; c < array[0].length; c++)
        output[r][c] = (int) array[r][c];
return output;
intdoubleToInt100000(double d)
double To Int
return (int) (d * 100000.0 + 0.5);
LongdoubleToInt64(Double r)
double To Int
if (r == null)
    return null;
if (r == Double.NaN)
    return null;
if (r == Double.POSITIVE_INFINITY)
    return null;
if (r == Double.NEGATIVE_INFINITY)
    return null;
...
longdoubleToInt64Bits(double d)
double To Int Bits
return Double.doubleToLongBits(d);