@Test public void testGetFraction() { double delta = 0.0000000000001; assertEquals(0.5d, ConfigurationTypeHelper.getFraction("0.5"), delta); assertEquals(3.0d, ConfigurationTypeHelper.getFraction("3"), delta); assertEquals(-0.25d, ConfigurationTypeHelper.getFraction("-25%"), delta); assertEquals(0.99546d, ConfigurationTypeHelper.getFraction("99.546%"), delta); assertEquals(0.0d, ConfigurationTypeHelper.getFraction("0%"), delta); assertEquals(0.0d, ConfigurationTypeHelper.getFraction("-0.000"), delta); assertEquals(0.001d, ConfigurationTypeHelper.getFraction(".1%"), delta); assertEquals(1d, ConfigurationTypeHelper.getFraction("1."), delta); }
public static double getFraction(String str) { if (!str.isEmpty() && str.charAt(str.length() - 1) == '%') return Double.parseDouble(str.substring(0, str.length() - 1)) / 100.0; return Double.parseDouble(str); }
ConfigurationTypeHelper { public static double getFraction(String str) { if (!str.isEmpty() && str.charAt(str.length() - 1) == '%') return Double.parseDouble(str.substring(0, str.length() - 1)) / 100.0; return Double.parseDouble(str); } }
ConfigurationTypeHelper { public static double getFraction(String str) { if (!str.isEmpty() && str.charAt(str.length() - 1) == '%') return Double.parseDouble(str.substring(0, str.length() - 1)) / 100.0; return Double.parseDouble(str); }  }
ConfigurationTypeHelper { public static double getFraction(String str) { if (!str.isEmpty() && str.charAt(str.length() - 1) == '%') return Double.parseDouble(str.substring(0, str.length() - 1)) / 100.0; return Double.parseDouble(str); }  static long getFixedMemoryAsBytes(String str); static long getMemoryAsBytes(String str); static long getTimeInMillis(String str); static double getFraction(String str); static T getClassInstance(String context, String clazzName, Class<T> base,
      T defaultInstance); static T getClassInstance(String context, String clazzName, Class<T> base); static int getNumThreads(String threads); }
ConfigurationTypeHelper { public static double getFraction(String str) { if (!str.isEmpty() && str.charAt(str.length() - 1) == '%') return Double.parseDouble(str.substring(0, str.length() - 1)) / 100.0; return Double.parseDouble(str); }  static long getFixedMemoryAsBytes(String str); static long getMemoryAsBytes(String str); static long getTimeInMillis(String str); static double getFraction(String str); static T getClassInstance(String context, String clazzName, Class<T> base,
      T defaultInstance); static T getClassInstance(String context, String clazzName, Class<T> base); static int getNumThreads(String threads);  }