Java Utililty Methods floor

List of utility methods to do floor

Description

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

Method

intfloor_double(double a)
Helper function for createNewPlayer
int b = (int) a;
return a >= (double) b ? b : b - 1;
intfloor_double(double value)
Returns the greatest integer less than or equal to the double argument
int i = (int) value;
return value < (double) i ? i - 1 : i;
longfloor_double_long(double d)
floodoubllong
long l = (long) d;
return d >= (double) l ? l : l - 1L;
intfloor_float(float f)
floofloat
int i = (int) f;
return f >= i ? i : i - 1;
intfloorAndCrop(final double x, final int min, final int max)
First calls Math.floor with x and then crops the resulting value to the range min to max.
final int rx = floorInt(x);
return crop(rx, min, max);
voidfloorData(float[] data, float floor)
If a data point is below 'floor' make it equal to floor.
for (int i = 0; i < data.length; i++) {
    if (data[i] < floor) {
        data[i] = floor;
longfloorDay(long milli)
floor Day
return milli - milli % DAY_IN_MILLIS;
intfloorDiv(final int x, final int y)
floor Div
int r = x / y;
if ((x ^ y) < 0 && (r * y != x)) {
    r--;
return r;
intfloorDiv(int dividend, int divisor)
Computes floored division.
return (int) Math.floor((double) dividend / (double) divisor);
intfloorDiv(int dividend, int divisor)
Computes the floored division dividend/divisor which is useful when dividing potentially negative numbers into bins.
boolean numpos = dividend >= 0, denpos = divisor >= 0;
if (numpos == denpos)
    return dividend / divisor;
return denpos ? (dividend - divisor + 1) / divisor : (dividend - divisor - 1) / divisor;