Java Utililty Methods Number Divide

List of utility methods to do Number Divide

Description

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

Method

Numberdivision(Number numerator, Number denominator)
Returns a Number representing the quotient of a division, or null if denominator is zero.
double denominatorValue = denominator.doubleValue();
if (denominatorValue == 0) {
    return null;
double numeratorValue = numerator.doubleValue();
double quotientValue = numeratorValue / denominatorValue;
return numberInJustNeededType(quotientValue);
bytedivmod(byte[] number, int firstDigit, int base, int divisor)
Divides a number, represented as an array of bytes each containing a single digit in the specified base, by the given divisor.
int remainder = 0;
for (int i = firstDigit; i < number.length; i++) {
    int digit = (int) number[i] & 0xFF;
    int temp = remainder * base + digit;
    number[i] = (byte) (temp / divisor);
    remainder = temp % divisor;
return (byte) remainder;
...
bytedivmod256(byte[] number58, int startAt)
divmod
int remainder = 0;
for (int i = startAt; i < number58.length; i++) {
    int digit58 = (int) number58[i] & 0xFF;
    int temp = remainder * 58 + digit58;
    number58[i] = (byte) (temp / 256);
    remainder = temp % 256;
return (byte) remainder;
...
StringdivRate(double v1, double v2)
div Rate
double d = div(v1, v2, DEF_DIV_SCALE);
double r = mul(d, 100);
return r + "%";
booleanisDivisible(Double a, int b, int decimal)
is Divisible
boolean result = false;
Double divideValue = divide(a.toString(), String.valueOf(b), 5, BigDecimal.ROUND_HALF_UP).doubleValue();
String divideStr = divideValue.toString();
String remainder = divideStr.substring(divideStr.lastIndexOf(".") + 1);
if ("0".equals(remainder)) {
    result = true;
} else {
    result = remainder.length() == decimal;
...