public static boolean intToBool(int input) { if (input < 0 || input > 1) { throw new IllegalParameterException("input must be 0 or 1"); } // Note we designate 1 as true and 0 as false though some may disagree return input == 1; }
private static void checkChar(String s, int index, BitSet authorized) throws IllegalParameterException { if (!authorized.get(s.charAt(index))) { throw new IllegalParameterException("Option name " + s + " cannot contain " + s.charAt(index) + " at position " + index); } }
throw new IllegalParameterException(); for (String name : names) { if (name == null) { throw new IllegalParameterException("Option name must not be null"); throw new IllegalParameterException("Option name cannot be empty"); throw new IllegalParameterException("Option name " + name + " cannot start with " + name.charAt(0));
// Foo filter public Mesh filter(Mesh inMesh, FilterParameters fp) { if (!(fp instanceof FooFilterParameters)) { throw new IllegalParameterException("Not FooFilterParameters."); } // Foo filter code here. }
private static void checkChar(String s, int index, BitSet authorized) throws IllegalParameterException { if (!authorized.get(s.charAt(index))) { throw new IllegalParameterException("Option name " + s + " cannot contain " + s.charAt(index) + " at position " + index); } }
private static void checkChar(String s, int index, BitSet authorized) throws IllegalParameterException { if (!authorized.get(s.charAt(index))) { throw new IllegalParameterException("Option name " + s + " cannot contain " + s.charAt(index) + " at position " + index); } }
throw new IllegalParameterException(); for (String name : names) { if (name == null) { throw new IllegalParameterException("Option name must not be null"); throw new IllegalParameterException("Option name cannot be empty"); throw new IllegalParameterException("Option name " + name + " cannot start with " + name.charAt(0));
throw new IllegalParameterException(); for (String name : names) { if (name == null) { throw new IllegalParameterException("Option name must not be null"); throw new IllegalParameterException("Option name cannot be empty"); throw new IllegalParameterException("Option name " + name + " cannot start with " + name.charAt(0));