Package com.atlassian.bamboo.util
Class NumberUtils
java.lang.Object
com.atlassian.bamboo.util.NumberUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidarrayStore(int number, @org.jetbrains.annotations.NotNull byte[] array, int startIndex) static voidarrayStore(long number, @org.jetbrains.annotations.NotNull byte[] array, int startIndex) static @Nullable DoublecreateDoubleQuietly(@Nullable String s) seeNumberUtils.createDouble(String).static NumberUtilsstatic booleanisPositiveInteger(@Nullable String input) static intmax(int a, int b) static <T extends Comparable<? super T>>
Tmax(@NotNull Collection<T> collection) static intmin(int a, int b) static StringpadWithZeroes(Number value, int numberOfZeroes) static longstatic doubleround(double val, int places) static floatround(float val, int places) static doubleDeprecated.static intstatic longstatic @Nullable Integerstatic doubleunlocalizedStringToDouble(@Nullable String s) Convert string to double value.static longNull-safe unboxing of Long
-
Method Details
-
getInstance
-
randomNonNegativeLong
public static long randomNonNegativeLong() -
min
public static int min(int a, int b) -
max
public static int max(int a, int b) -
round
public static double round(double val, int places) -
round
public static float round(float val, int places) -
padWithZeroes
-
stringToDouble
Deprecated.since 4.2 consider usingcreateDoubleQuietly(String)- Returns:
-
createDoubleQuietly
seeNumberUtils.createDouble(String). Returns null instead of throwing an exception. -
unlocalizedStringToDouble
Convert string to double value. Method expects non-localized input (as produced byDouble.toString(double)). If the input cannot be parsed method would log this and return 0.This method is intended to be used from FreeMarker code.
- Parameters:
s- input string containing representation of a double value.- Returns:
- parsed value or 0 if there was error during parsing
-
stringToLong
-
stringToInt
-
max
-
isPositiveInteger
-
arrayStore
public static void arrayStore(int number, @NotNull @org.jetbrains.annotations.NotNull byte[] array, int startIndex) -
arrayStore
public static void arrayStore(long number, @NotNull @org.jetbrains.annotations.NotNull byte[] array, int startIndex) -
valueOf
Null-safe unboxing of Long- Parameters:
l- value to unboxdefaultValue- default value to return if l is null
-
toInteger
-
createDoubleQuietly(String)