private static HexString createHexString(String hex) { // though method is private, leaving checks in place to show intent if (hex == null) { throw new IllegalArgumentException("hex string argument cannot be null; use HexString.NULL instead"); } else if (hex.equals("")) { throw new IllegalArgumentException("hex string argument cannot be empty; use HexString.NULL instead"); } byte[] bytes = toByteArray(hex); return new HexString(bytes, hex.toUpperCase()); }
private static HexString createHexString(String hex) { // though method is private, leaving checks in place to show intent if (hex == null) { throw new IllegalArgumentException("hex string argument cannot be null; use HexString.NULL instead"); } else if (hex.equals("")) { throw new IllegalArgumentException("hex string argument cannot be empty; use HexString.NULL instead"); } byte[] bytes = toByteArray(hex); return new HexString(bytes, hex.toUpperCase()); }
private static HexString createHexString(byte[] bytes) { // though method is private, leaving checks in place to show intent if (bytes == null) { throw new IllegalArgumentException("bytes argument cannot be null; use HexString.NULL instead"); } else if (bytes.length == 0) { throw new IllegalArgumentException("bytes argument cannot be zero length; use HexString.NULL instead"); } byte[] copyOfbytes = copyByteArray(bytes); String hex = toHexString(copyOfbytes).toUpperCase(); return new HexString(copyOfbytes, hex); }
private static HexString createHexString(byte[] bytes) { // though method is private, leaving checks in place to show intent if (bytes == null) { throw new IllegalArgumentException("bytes argument cannot be null; use HexString.NULL instead"); } else if (bytes.length == 0) { throw new IllegalArgumentException("bytes argument cannot be zero length; use HexString.NULL instead"); } byte[] copyOfbytes = copyByteArray(bytes); String hex = toHexString(copyOfbytes).toUpperCase(); return new HexString(copyOfbytes, hex); }