### Question:
Convert { public static final byte[] toBytes(int i){ if(i < INT_N_65535 || i > INT_P_65535) { return Integer.toString(i).getBytes(); } final int absi = Math.abs(i); final byte[] cachedData = i2b_65535[absi]; final byte[] data; if(cachedData == null) { data = Integer.toString(absi).getBytes(); i2b_65535[absi] = data; } else { data = cachedData; } return i >= 0 ? data : getNegativeNumberBytes(data); }  static final byte[] toBytes(int i); static final byte[] toBytes(long lnum); static final byte[] toBytes(double dnum); static final int toInt(final byte[] potentiallySignedAsciiBytes, final int offsetin, final int len); static final long toLong(byte[] potentiallySignedAsciiBytes, final int offsetin, int len); static final int toInt(byte[] potentiallySignedBytes); static final long toLong(byte[] potentiallySignedBytes); static final double toDouble(byte[] stringRepOfDoublePrecisionBytes); static final int INT_P_65535; static final int INT_N_65535; }### Answer:
@Test public void testToBytes() { Log.log("Testing number to bytes conversion ..."); byte[] javadata = null; byte[] data = null; int n; n=Integer.MIN_VALUE; javadata = Integer.toString(n).getBytes(); data = Convert.toBytes(n); assertEquals (data.length, javadata.length, "buffer length"); for(int j=0; j<data.length;j++) assertEquals(data[j], javadata[j], "for <"+n+"> byte @ ["+j+"]"); n=Integer.MAX_VALUE; javadata = Integer.toString(n).getBytes(); data = Convert.toBytes(n); assertEquals (data.length, javadata.length, "buffer length"); for(int j=0; j<data.length;j++) assertEquals(data[j], javadata[j], "for <"+n+"> byte @ ["+j+"]"); n=Convert.INT_N_65535 - 444; javadata = Integer.toString(n).getBytes(); data = Convert.toBytes(n); assertEquals (data.length, javadata.length, "buffer length"); for(int j=0; j<data.length;j++) assertEquals(data[j], javadata[j], "for <"+n+"> byte @ ["+j+"]"); n=Convert.INT_P_65535 + 444; javadata = Integer.toString(n).getBytes(); data = Convert.toBytes(n); assertEquals (javadata.length, data.length, "buffer length"); for(int j=0; j<data.length;j++) assertEquals( data[j], javadata[j], "for <"+n+"> byte @ ["+j+"]"); for(int i=Convert.INT_N_65535; i<Convert.INT_P_65535; i++){ javadata = Integer.toString(i).getBytes(); data = Convert.toBytes(i); assertEquals (data.length, javadata.length, "buffer length" ); for(int j=0; j<data.length;j++) assertEquals( data[j], javadata[j], "for <"+i+"> byte @ ["+j+"]"); } }