public class NumberUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NumberUtils.Shuffler |
| Constructor and Description |
|---|
NumberUtils() |
| Modifier and Type | Method and Description |
|---|---|
static double |
convertDoubleToPercentage(double doub) |
static double |
convertPercentageToDouble(double percent) |
static String |
createRandomStringOfNumbers(int digits) |
static boolean |
doRandomPercentage(int i) |
static boolean |
equals(double one,
double two,
double delta) |
static int |
floor(double i) |
static int |
getMax(int value1,
int value2) |
static int |
getNumberOfDigits(int number) |
static int |
getRandomInt(int minimum,
int maximum)
randomly chooses a number between the minimum and maximum
Example:
int grade = NumberUtils.getRandomInt(1,100); |
static <T> T[] |
getShuffled(T[] objects,
int numberToReturn) |
static boolean |
isEven(int number) |
static boolean |
isIn(int check,
int[] available) |
static boolean |
load(String i,
boolean d) |
static double |
load(String i,
double defaultValue) |
static int |
load(String i,
int defaultValue)
Loads an int from a String.
|
static int |
load(String i,
int defaultValue,
boolean stripNonNumeric)
Loads an int from a String.
|
static long |
load(String i,
long defaultValue)
Loads an int from a String.
|
static int[] |
loadArray(String summaryString,
String seperator,
int defaultWhenLoading) |
static void |
main(String[] args)
a unit test of sorts
|
static double |
setSignificantDigit(double onNumber,
int digit) |
static DoubleStream |
toDoubleStream(double[] numbers) |
static DoubleStream |
toDoubleStream(Double[] numbers) |
static DoubleStream |
toDoubleStream(List<Double> numbers) |
static IntStream |
toIntStream(int[] numbers) |
static IntStream |
toIntStream(Integer[] numbers) |
static IntStream |
toIntStream(List<Integer> numbers) |
static LongStream |
toLongStream(List<Long> numbers) |
static LongStream |
toLongStream(long[] numbers) |
static LongStream |
toLongStream(Long[] numbers) |
static Integer[] |
wrapIntegers(int[] ints) |
public static Random RANDOM
public static int getMax(int value1,
int value2)
public static int load(String i, int defaultValue)
public static int load(String i, int defaultValue, boolean stripNonNumeric)
public static long load(String i, long defaultValue)
public static double load(String i, double defaultValue)
public static boolean load(String i, boolean d)
public static int[] loadArray(String summaryString, String seperator, int defaultWhenLoading)
public static double setSignificantDigit(double onNumber,
int digit)
public static void main(String[] args)
public static boolean doRandomPercentage(int i)
public static boolean equals(double one,
double two,
double delta)
public static Integer[] wrapIntegers(int[] ints)
public static String createRandomStringOfNumbers(int digits)
public static boolean isIn(int check,
int[] available)
public static boolean isEven(int number)
public static <T> T[] getShuffled(T[] objects,
int numberToReturn)
public static int getRandomInt(int minimum,
int maximum)
int grade = NumberUtils.getRandomInt(1,100); minimum - The lowest possible value (inclusive)maximum - The highest possible value (inclusive)public static int floor(double i)
public static int getNumberOfDigits(int number)
public static double convertDoubleToPercentage(double doub)
public static double convertPercentageToDouble(double percent)
public static IntStream toIntStream(int[] numbers)
public static LongStream toLongStream(long[] numbers)
public static LongStream toLongStream(Long[] numbers)
public static LongStream toLongStream(List<Long> numbers)
public static DoubleStream toDoubleStream(double[] numbers)
public static DoubleStream toDoubleStream(Double[] numbers)
public static DoubleStream toDoubleStream(List<Double> numbers)
Copyright © 2021. All rights reserved.