com.atlassian.bamboo.util
Class NumberUtils

java.lang.Object
  extended by com.atlassian.bamboo.util.NumberUtils

public class NumberUtils
extends java.lang.Object


Method Summary
static void arrayStore(int number, byte[] array, int startIndex)
           
static void arrayStore(long number, byte[] array, int startIndex)
           
static java.lang.Double createDoubleQuietly(java.lang.String s)
           
static NumberUtils getInstance()
           
static boolean isPositiveInteger(java.lang.String input)
           
static
<T extends java.lang.Comparable<? super T>>
T
max(java.util.Collection<T> collection)
           
static int max(int a, int b)
           
static int min(int a, int b)
           
static java.lang.String padWithZeroes(java.lang.Number value, int numberOfZeroes)
           
static double round(double val, int places)
           
static float round(float val, int places)
           
static double stringToDouble(java.lang.String s)
          Deprecated. since 4.2 consider using $createDoubleQuietly(String)
static int stringToInt(java.lang.String s)
           
static long stringToLong(java.lang.String s)
           
static double unlocalizedStringToDouble(java.lang.String s)
          Convert string to double value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static NumberUtils getInstance()

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

public static java.lang.String padWithZeroes(java.lang.Number value,
                                             int numberOfZeroes)

stringToDouble

@Deprecated
public static double stringToDouble(java.lang.String s)
Deprecated. since 4.2 consider using $createDoubleQuietly(String)

Returns:

createDoubleQuietly

@Nullable
public static java.lang.Double createDoubleQuietly(@Nullable
                                                            java.lang.String s)
See Also:
org.apache.commons.lang.math.NumberUtils.createDouble(s)}. Returns null instead of throwing an exception.

unlocalizedStringToDouble

public static double unlocalizedStringToDouble(@Nullable
                                               java.lang.String s)
Convert string to double value. Method expects non-localized input (as produced by Double.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

public static long stringToLong(java.lang.String s)

stringToInt

public static int stringToInt(java.lang.String s)

max

public static <T extends java.lang.Comparable<? super T>> T max(@NotNull
                                                                java.util.Collection<T> collection)

isPositiveInteger

public static boolean isPositiveInteger(@Nullable
                                        java.lang.String input)

arrayStore

public static void arrayStore(int number,
                              @NotNull
                              byte[] array,
                              int startIndex)

arrayStore

public static void arrayStore(long number,
                              @NotNull
                              byte[] array,
                              int startIndex)


Copyright © 2012 Atlassian. All Rights Reserved.