Splits a double value into it's sexagesimal parts. Each part has
the same sign as the provided value.

@param value
Value to split
@return Split parts
972609
private int[] sexagesimalSplit(final double value)
  {
    final double absValue = Math.abs(value);

    int units;
    int minutes;
    int seconds;
    final int sign = value < 0? -1: 1;

    // Calculate absolute integer units
    units = (int) Math.floor(absValue);
    seconds = (int) Math.round((absValue - units) * 3600D);

    // Calculate absolute integer minutes
    minutes = seconds / 60; // Integer arithmetic
    if (minutes == 60)
    {
      minutes = 0;
      units++;
    }

    // Calculate absolute integer seconds
    seconds = seconds % 60;

    // Correct for sign
    units = units * sign;
    minutes = minutes * sign;
    seconds = seconds * sign;

    return new int[] {
        units, minutes, seconds
    };
  }
287554
public static CurrencySymbolPosition getSymbolPosition(int value)
   {
      CurrencySymbolPosition result;

      switch (value)
      {
         case 1:
         {
            result = CurrencySymbolPosition.AFTER;
            break;
         }

         case 2:
         {
            result = CurrencySymbolPosition.BEFORE_WITH_SPACE;
            break;
         }

         case 3:
         {
            result = CurrencySymbolPosition.AFTER_WITH_SPACE;
            break;
         }

         case 0:
         default:
         {
            result = CurrencySymbolPosition.BEFORE;
            break;
         }
      }

      return (result);
   }
43915
public static double fixAmount(final double value) {
		final BigDecimal b1 = new BigDecimal(value);
		final BigDecimal b2 = b1.setScale(3, BigDecimal.ROUND_HALF_UP);
		return b2.doubleValue();
	}
991266
@Pure
	@Inline(value = "EndianNumbers.parseBELong(Double.doubleToLongBits($1))",
			imported = {EndianNumbers.class})
	public static byte[] parseBEDouble(double value) {
		return parseBELong(Double.doubleToLongBits(value));
    }
719024
public static String getDigits(String value) {

    StringBuilder digits = new StringBuilder(value.length());

    for (char chr : value.toCharArray()) {
      if (Character.isDigit(chr)) {
        digits.append(chr);
      }
    }

    return digits.toString();
  }
901473
private String getPercentFormatted(final Integer value)
	{
		final Integer val = checkQuietly(getName(), value);
		return NumberFormat.getPercentInstance().format((double)val / 100);
	}
1193767
public static String[] splitPreserveAllTokens(String value, char separatorChar) {
    if (value == null) {
      return ArrayUtils.EMPTY_STRING_ARRAY;
    }
    int len = value.length();
    if (len == 0) {
      return ArrayUtils.EMPTY_STRING_ARRAY;
    }
    List<String> list = new ArrayList<>();
    int i = 0;
    int start = 0;
    boolean match = false;
    boolean lastMatch = false;
    int escapeStart = -2;
    while (i < len) {
      char c = value.charAt(i);
      if (c == ESCAPE_CHAR) {
        escapeStart = i;
      }
      if (c == separatorChar && escapeStart != i - 1) {
        lastMatch = true;
        list.add(value.substring(start, i));
        match = false;
        start = ++i;
        continue;
      }
      match = true;
      i++;
    }
    if (match || lastMatch) {
      list.add(value.substring(start, i));
    }
    return list.toArray(new String[list.size()]);
  }
443408
List<String> split(String value) {
        if (value == null) {
            return Collections.emptyList();
        }
        String[] parts = value.split(",", -1);
        return Arrays.asList(parts);
    }
926282
public Expression<Double> gt(double value) {
		String valueString = "'" + value + "'";
		return new Expression<Double>(this, Operation.gt, valueString);
	}
1325347
private long parseDuration(String value) {
	        long periodMS = 0L;
	        if (value!=null) {
	            String[] parts = value.split(":");
	            for (int i = 0; i < parts.length; i++) {
	                switch (i) {
	                    case 0: // hours
	                        periodMS += (Integer.parseInt(parts[i])) * 3600000L;
	                        break;
	                    case 1: // minutes
	                        periodMS += (Integer.parseInt(parts[i])) * 60000L;
	                        break;
	                    case 2: // seconds
	                        periodMS += (Integer.parseInt(parts[i])) * 1000L;
	                        break;
	                    case 3: // ms
	                        periodMS += (Integer.parseInt(parts[i]));
	                        break;
	                    default:
	                        break;
	                }
	            }
	        }
	        return periodMS;
	    }
595820
public static String formatSize(final long value) {
        double size = value;
        DecimalFormat df = new DecimalFormat("#.##");
        if (size >= GB) {
            return df.format(size / GB) + " GB";
        }
        if (size >= MB) {
            return df.format(size / MB) + " MB";
        }
        if (size >= KB) {
            return df.format(size / KB) + " KB";
        }
        return String.valueOf((int) size) + " bytes";
    }
304786
public double getNumericValue(Part part) {
        Part.Type type=part.type;
        if(type==Part.Type.ARG_INT) {
            return part.value;
        } else if(type==Part.Type.ARG_DOUBLE) {
            return numericValues.get(part.value);
        } else {
            return NO_NUMERIC_VALUE;
        }
    }
656242
public static String formatAsPercentage(int value, int total) {
        // value '1F' is to force floating conversion instead of loosing decimal part
        float average = total == 0 ? 0 : 1F * value / total;
        return PERCENT_FORMATTER.format(average);
    }
1180581
@Override
    public Object convert(String value) {
        if (value == null || value.isEmpty()) {
            return value;
        }

        Object result = Ints.tryParse(value);

        if (result != null) {
            return result;
        }

        result = Longs.tryParse(value);

        if (result != null) {
            return result;
        }

        result = Doubles.tryParse(value);

        if (result != null) {
            return result;
        }

        return value;
    }
203699
public StringTextValue<String> setValue(final Integer value)
	{
		final String percentFormatted = getPercentFormatted(value);
		return setValue(percentFormatted);
	}
678635
public List<Double> parse(String values) {
        List<Double> inputValues = new ArrayList<Double>();
        if (!(values.isEmpty() || values.charAt(0) == '#')) {
            StringTokenizer tokenizer = new StringTokenizer(values);
            while (tokenizer.hasMoreTokens()) {
                inputValues.add(Op.toDouble(tokenizer.nextToken()));
            }
        }
        return inputValues;
    }
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());
		}
	}