Package com.atlassian.bamboo.util
Class NumberUtils
java.lang.Object
com.atlassian.bamboo.util.NumberUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
arrayStore
(int number, @org.jetbrains.annotations.NotNull byte[] array, int startIndex) static void
arrayStore
(long number, @org.jetbrains.annotations.NotNull byte[] array, int startIndex) static @Nullable Double
createDoubleQuietly
(@Nullable String s) seeNumberUtils.createDouble(String)
.static NumberUtils
static boolean
isPositiveInteger
(@Nullable String input) static int
max
(int a, int b) static <T extends Comparable<? super T>>
Tmax
(@NotNull Collection<T> collection) static int
min
(int a, int b) static String
padWithZeroes
(Number value, int numberOfZeroes) static long
static double
round
(double val, int places) static float
round
(float val, int places) static double
Deprecated.static int
static long
static @Nullable Integer
static double
unlocalizedStringToDouble
(@Nullable String s) Convert string to double value.static long
Null-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)