### Question:
ByteUtil { public static byte[] encodeValFor32Bits(Object arg) { byte[] data; if (arg.toString().trim().matches("-?\\d+(\\.\\d+)?")) { data = new BigInteger(arg.toString().trim()).toByteArray(); } else if (arg.toString().trim().matches("0[xX][0-9a-fA-F]+")) { data = new BigInteger(arg.toString().trim().substring(2), 16).toByteArray(); } else { data = arg.toString().trim().getBytes(); } if (data.length > 32) { throw new RuntimeException("values can't be more than 32 byte"); } byte[] val = new byte[32]; int j = 0; for (int i = data.length; i > 0; --i) { val[31 - j] = data[i - 1]; ++j; } return val; }  static byte[] appendByte(byte[] bytes, byte b); static byte[] bigIntegerToBytes(BigInteger b, int numBytes); static byte[] bigIntegerToBytesSigned(BigInteger b, int numBytes); static byte[] bigIntegerToBytes(BigInteger value); static BigInteger bytesToBigInteger(byte[] bb); static int matchingNibbleLength(byte[] a, byte[] b); static void toLEByteArray(byte[] toConvert); static byte[] longToBytes(long val); static byte[] longToBytesLE(long val); static byte[] longToBytesNoLeadZeroes(long val); static byte[] intToBytes(int val); static byte[] intToBytesLE(int val); static byte[] intToBytesBE(int val); static byte[] intToBytesNoLeadZeroes(int val); static String toHexString(byte[] data); static String toHexStringWithPrefix(byte[] data); static byte[] calcPacketLength(byte[] msg); static int byteArrayToInt(byte[] b); static long byteArrayToLong(byte[] b); static byte toByte(byte[] b); static String nibblesToPrettyString(byte[] nibbles); static String oneByteToHexString(byte value); static int numBytes(String val); static byte[] encodeValFor32Bits(Object arg); static byte[] encodeDataList(Object... args); static int firstNonZeroByte(byte[] data); static byte[] stripLeadingZeroes(byte[] data); static boolean increment(byte[] bytes); static byte[] copyToArray(BigInteger value); static byte[] setBit(byte[] data, int pos, int val); static int getBit(byte[] data, int pos); static byte[] and(byte[] b1, byte[] b2); static byte[] or(byte[] b1, byte[] b2); static byte[] xor(byte[] b1, byte[] b2); static byte[] xorAlignRight(byte[] b1, byte[] b2); static byte[] merge(byte[]... arrays); static boolean isNullOrZeroArray(byte[] array); static boolean isSingleZero(byte[] array); static Set<byte[]> difference(Set<byte[]> setA, Set<byte[]> setB); static int length(byte[]... bytes); static byte[] intsToBytes(int[] arr, boolean bigEndian); static int[] bytesToInts(byte[] arr, boolean bigEndian); static void bytesToInts(byte[] b, int[] arr, boolean bigEndian); static void intsToBytes(int[] arr, byte[] b, boolean bigEndian); static short bigEndianToShort(byte[] bs); static short bigEndianToShort(byte[] bs, int off); static byte[] shortToBytes(short n); static byte[] hexStringToBytes(String data); static byte[] chop(byte[] in); static final byte[] EMPTY_WORD; static final byte[] EMPTY_HALFWORD; static final byte[] EMPTY_BYTE_ARRAY; static final byte[] ZERO_BYTE_ARRAY; static final String EMPTY_STRING; }### Answer:
@Test public void objectTest() { for (String[] strings : testNum) { try { encodeValFor32Bits(strings[1]); } catch (NullPointerException e) { System.out.println("\nNull Object Test!"); } } }