Package io.ultreia.java4all.lang
Class Numbers
- java.lang.Object
-
- io.ultreia.java4all.lang.Numbers
-
public class Numbers extends Object
Created by tchemit on 29/12/2017.- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Field Summary
Fields Modifier and Type Field Description static Predicate<Float>NULL_OR_ZERO_FLOAT_FIVE_DIGITSstatic Predicate<Float>NULL_OR_ZERO_FLOAT_FOUR_DIGITSstatic Predicate<Float>NULL_OR_ZERO_FLOAT_ONE_DIGITstatic Predicate<Float>NULL_OR_ZERO_FLOAT_THREE_DIGITSstatic Predicate<Float>NULL_OR_ZERO_FLOAT_TWO_DIGITSstatic Predicate<Integer>NULL_OR_ZERO_INTEGER
-
Constructor Summary
Constructors Constructor Description Numbers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]divideAndEnsureSum(int divisor, int dividend)Divide the divisor by the dividend.static Floatround(Float number, MathContext mc)static FloatroundFourDigits(Float number)static FloatroundNDigits(Float number, int digits)static FloatroundOneDigit(Float number)static FloatroundThreeDigits(Float number)static FloatroundTwoDigits(Float number)
-
-
-
Method Detail
-
divideAndEnsureSum
public static int[] divideAndEnsureSum(int divisor, int dividend)Divide the divisor by the dividend. Returns an array containing the quotients rounded up or down to ensure the sum of the quotients equals the divisor.e.g. divideAndEnsureSum(100, 3) returns {34, 33, 33}
- Parameters:
divisor- the divisordividend- the dividend- Returns:
- an array whose length equals dividend
-
round
public static Float round(Float number, MathContext mc)
-
-