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 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)
           
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

public static double stringToDouble(java.lang.String s)

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)


Copyright © 2011 Atlassian. All Rights Reserved.