@Test(expected = IllegalArgumentException.class) public void testGetFixedMemoryAsBytesFailureCases1() { ConfigurationTypeHelper.getFixedMemoryAsBytes("42x"); }
public static long getFixedMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == 'b') { log.warn( "The 'b' in {} is being considered as bytes. Setting memory by bits is not supported", str); } try { int multiplier; switch (Character.toUpperCase(lastChar)) { case 'G': multiplier = 30; break; case 'M': multiplier = 20; break; case 'K': multiplier = 10; break; case 'B': multiplier = 0; break; default: return Long.parseLong(str); } return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting. A valid value would a number " + "possibly followed by an optional 'G', 'M', 'K', or 'B'."); } }
ConfigurationTypeHelper { public static long getFixedMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == 'b') { log.warn( "The 'b' in {} is being considered as bytes. Setting memory by bits is not supported", str); } try { int multiplier; switch (Character.toUpperCase(lastChar)) { case 'G': multiplier = 30; break; case 'M': multiplier = 20; break; case 'K': multiplier = 10; break; case 'B': multiplier = 0; break; default: return Long.parseLong(str); } return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting. A valid value would a number " + "possibly followed by an optional 'G', 'M', 'K', or 'B'."); } } }
ConfigurationTypeHelper { public static long getFixedMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == 'b') { log.warn( "The 'b' in {} is being considered as bytes. Setting memory by bits is not supported", str); } try { int multiplier; switch (Character.toUpperCase(lastChar)) { case 'G': multiplier = 30; break; case 'M': multiplier = 20; break; case 'K': multiplier = 10; break; case 'B': multiplier = 0; break; default: return Long.parseLong(str); } return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting. A valid value would a number " + "possibly followed by an optional 'G', 'M', 'K', or 'B'."); } }  }
ConfigurationTypeHelper { public static long getFixedMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == 'b') { log.warn( "The 'b' in {} is being considered as bytes. Setting memory by bits is not supported", str); } try { int multiplier; switch (Character.toUpperCase(lastChar)) { case 'G': multiplier = 30; break; case 'M': multiplier = 20; break; case 'K': multiplier = 10; break; case 'B': multiplier = 0; break; default: return Long.parseLong(str); } return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting. A valid value would a number " + "possibly followed by an optional 'G', 'M', 'K', or 'B'."); } }  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 getFixedMemoryAsBytes(String str) { char lastChar = str.charAt(str.length() - 1); if (lastChar == 'b') { log.warn( "The 'b' in {} is being considered as bytes. Setting memory by bits is not supported", str); } try { int multiplier; switch (Character.toUpperCase(lastChar)) { case 'G': multiplier = 30; break; case 'M': multiplier = 20; break; case 'K': multiplier = 10; break; case 'B': multiplier = 0; break; default: return Long.parseLong(str); } return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier; } catch (Exception ex) { throw new IllegalArgumentException( "The value '" + str + "' is not a valid memory setting. A valid value would a number " + "possibly followed by an optional 'G', 'M', 'K', or 'B'."); } }  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);  }