Parse scale from string representation.

@param value to parse
@return scale value
547558
public static Double stringToScale(String value) {
		NumberFormat numberFormat = NumberFormat.getFormat("###,###");
		String[] scale2 = value.split(":");
		if (scale2.length == 1) {
			return 1.0 / numberFormat.parse(scale2[0].trim());
		} else {
			return numberFormat.parse(scale2[0].trim()) / numberFormat.parse(scale2[1].trim());
		}
	}
825016
public static Number parseNumber( String value ) {
        // Try to parse as a number ...
        char c = value.charAt(0);

        if ((c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+') {
            // It's definitely a number ...
            if (c == '0' && value.length() > 2) {
                // it might be a hex number that starts with '0x'
                char two = value.charAt(1);
                if (two == 'x' || two == 'X') {
                    try {
                        // Parse the remainder of the hex number ...
                        return Integer.parseInt(value.substring(2), 16);
                    } catch (NumberFormatException e) {
                        // Ignore and continue ...
                    }
                }
            }
            // Try parsing as a double ...
            try {
                if ((value.indexOf('.') > -1) || (value.indexOf('E') > -1) || (value.indexOf('e') > -1)) {
                    return Double.parseDouble(value);
                }
                Long longObj = new Long(value);
                long longValue = longObj.longValue();
                int intValue = longObj.intValue();
                if (longValue == intValue) {
                    // Then it's just an integer ...
                    return new Integer(intValue);
                }
                return longObj;
            } catch (NumberFormatException e) {
                // ignore ...
            }
        }
        return null;
    }
890844
public static final Date parseDate(String value)
   {
      Date result = null;

      try
      {
         if (value != null && !value.isEmpty())
         {
            result = DATE_FORMAT.get().parse(value);
         }
      }
      catch (ParseException ex)
      {
         // Ignore
      }

      return result;
   }
961520
public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value)
   {
      CurrencySymbolPosition result = MAP_TO_CURRENCY_SYMBOL_POSITION.get(value);
      result = result == null ? CurrencySymbolPosition.BEFORE_WITH_SPACE : result;
      return result;
   }
267470
private Double scale(Double value, Double min, Double max) {
        if(min.equals(max)) {
            if(value>max) {
                return 1.0;
            }
            else if(value==max && value!=0.0) {
                return 1.0;
            }
            else {
                return 0.0;
            }
        }
        else {
            return (value-min)/(max-min);
        }
    }
418027
public static String scaleToString(double scale, int precision, int significantDigits) {
		NumberFormat numberFormat = NumberFormat.getFormat("###,###");
		if (scale > 0 && scale < 1.0) {
			int denominator = round((int) Math.round(1.0 / scale), precision, significantDigits);
			return "1 : " + numberFormat.format(denominator);
		} else if (scale >= 1.0) {
			int nominator = round((int) Math.round(scale), precision, significantDigits);
			return numberFormat.format(nominator) + " : 1";
		} else {
			return ERROR_SCALE;
		}
	}
688003
public static function parseString($value) {
        if (null === $value) {
            return null;
        }
        if (0 === preg_match("/^[0-9]{1,}(\.[0-9]{0,})?$/", $value)) {
            throw new FloatArgumentException($value);
        }
        return floatval($value);
    }
544049
public static Range valueOf(final String value) {
        final Optional<Integer[]> vals = parse(value);
        if (vals.isPresent()) {
            return new Range(vals.get()[0], vals.get()[1]);
        }
        return null;
    }
449144
public Geometry parse(String value) {
        ByteGetter.StringByteGetter bytes = new ByteGetter.StringByteGetter(value);
        return this.parseGeometry(valueGetterForEndian(bytes));
    }
418010
public String format(Object value) {
    ValueFormatter<Object> valueFormatter = VALUE_FORMATTERS.get(value.getClass());
    if (valueFormatter != null) {
      return valueFormatter.format(this, value);
    } else {
      return value.toString();
    }
  }
508434
public static BigDecimal inverse(final BigDecimal value, final int scale) {
        return inverse(value, scale, BigDecimal.ROUND_HALF_UP);
    }
263226
private static double convertStringToDouble(final String value) {
    double doubleValue = 0;
    if(!StringUtils.isBlank(value)) {
      try {
        doubleValue = Double.parseDouble(value.trim());
      }
      catch(Exception e) {
        // do nothing
      }
    }
    return doubleValue;
  }
189884
public static Integer parseInteger(String value) throws ParseException
   {
      Integer result = null;

      if (value.length() > 0 && value.indexOf(' ') == -1)
      {
         if (value.indexOf('.') == -1)
         {
            result = Integer.valueOf(value);
         }
         else
         {
            Number n = DatatypeConverter.parseDouble(value);
            result = Integer.valueOf(n.intValue());
         }
      }

      return result;
   }
614011
public static VersionCompare forString(final String value) {

        VersionCompare vers = new VersionCompare();
        if (null == value || "".equals(value)) {
            return vers;
        }

        String[] parr1 = value.split("-", 2);
        String[] v1arr = parr1[0].split("\\.", 3);
        if (v1arr.length > 0) {
            vers.majString = v1arr[0];
            try {
                vers.maj = Integer.parseInt(vers.majString);
            } catch (NumberFormatException e) {
            }
        }
        if (v1arr.length > 1) {
            vers.minString = v1arr[1];
            try {
                vers.min = Integer.parseInt(vers.minString);
            } catch (NumberFormatException e) {
            }
        }
        if (v1arr.length > 2) {
            vers.patchString = v1arr[2];
            try {
                vers.patch = Integer.parseInt(vers.patchString);
            } catch (NumberFormatException e) {
            }
        }
        if (parr1.length > 1) {
            vers.tag = parr1[1];
        }
        return vers;
    }
729754
public void scale(float value) {
		r *= value;
		g *= value;
		b *= value;
		a *= value;
	}
224257
private static Object toInt( BigDecimal value)
    {
    Object number;
        
    try
      {
      number =
        value.scale() == 0
        ? Integer.valueOf( value.intValueExact())
        : null;
      }
    catch( Exception e)
      {
      number = null;
      }
        
    return number;
    }
991025
public static BigDecimal inverse(final BigDecimal value) {
        if (isNotZero(value)) {
            return BigDecimal.ONE.setScale(MAX_SCALE_FOR_INVERSE).divide(value, BigDecimal.ROUND_HALF_UP);
        }
        return null;
    }