@Test(expected = IllegalArgumentException.class) public void testGetMemoryAsBytesFailureCases1() { ConfigurationTypeHelper.getMemoryAsBytes("42x"); }
public static long getMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == '%') { try { int percent = Integer.parseInt(str.substring(0, str.length() - 1)); if (percent <= 0 || percent >= 100) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } return Runtime.getRuntime().maxMemory() * percent / 100; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } } return getFixedMemoryAsBytes(str); }
ConfigurationTypeHelper { public static long getMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == '%') { try { int percent = Integer.parseInt(str.substring(0, str.length() - 1)); if (percent <= 0 || percent >= 100) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } return Runtime.getRuntime().maxMemory() * percent / 100; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } } return getFixedMemoryAsBytes(str); } }
ConfigurationTypeHelper { public static long getMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == '%') { try { int percent = Integer.parseInt(str.substring(0, str.length() - 1)); if (percent <= 0 || percent >= 100) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } return Runtime.getRuntime().maxMemory() * percent / 100; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } } return getFixedMemoryAsBytes(str); }  }
ConfigurationTypeHelper { public static long getMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == '%') { try { int percent = Integer.parseInt(str.substring(0, str.length() - 1)); if (percent <= 0 || percent >= 100) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } return Runtime.getRuntime().maxMemory() * percent / 100; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } } return getFixedMemoryAsBytes(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 long getMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == '%') { try { int percent = Integer.parseInt(str.substring(0, str.length() - 1)); if (percent <= 0 || percent >= 100) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } return Runtime.getRuntime().maxMemory() * percent / 100; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting."); } } return getFixedMemoryAsBytes(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);  }