List of utility methods to do Long Number Divide
long | div(long dividend, long divisor) div if (dividend < 0) { return Math.round((double) (dividend - divisor + 1) / (double) divisor); return Math.round((double) dividend / (double) divisor); |
String | div100(Long input) div if (input == null || input == 0) { return "0.0"; Double fl = input / 100d; DecimalFormat df = new DecimalFormat("#.##"); df.setRoundingMode(RoundingMode.FLOOR); return df.format(fl); |
long | div_ceil(long n, long d) Div_ceil. long v = (long) ((n / d) + (n % d != 0 ? 1 : 0)); return v; |
long | divCeil(long a, long b) div Ceil if (b < 0) { return divCeil(-a, -b); } else if (a >= 0) { return ((a + b - 1) / b); return a / b; |
double | divide(final long dividend, final long divisor) divide if (divisor == 0) return 0; return 1.0 * dividend / divisor; |
String | divide(Long d1, Long d2) divide if (d1 == null || d2 == null || d2.equals(0l)) { return "0"; double percent = (double) d1 / d2; DecimalFormat format = new DecimalFormat("0.00"); return format.format(percent); |
long | divide(long dividend, long divisor) Returns dividend / divisor, where the dividend and divisor are treated as unsigned 64-bit quantities. if (divisor < 0) { if (compareUnsigned(dividend, divisor) < 0) { return 0; } else { return 1; if (dividend >= 0) { ... |
double | divide(long l1, long l2) divide NumberFormat nf = DecimalFormat.getInstance(Locale.ENGLISH); DecimalFormat df = (DecimalFormat) nf; df.applyPattern("#.##########"); double percent = (double) l1 / (double) l2; return Double.parseDouble(df.format(percent)); |
long | divideAndRoundUp(long x, long y) divide And Round Up return (x + y - 1) / y;
|
long | divideForMean(long sum, long count) Divides the sum by the count for an arithmetic mean. return (count == 0) ? -1 : sum / count;
|