### Question:
IndexUtils { public static byte[] toBytes(IndexExpression indexExpression) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(indexExpression); return bos.toByteArray(); } private  IndexUtils(); static byte[] toBytes(IndexExpression indexExpression); static IndexExpression toIndexExpression(byte[] bytes);  }### Answer:
@Test public void testConvertingSimpleIndexExpressionToByteArray() throws Exception { SingleIndexExpression singleIndexExpression = new SingleIndexExpression("idx1"); Column column = new Column(FAMILY1, QUALIFIER1); byte[] value = "1".getBytes(); EqualsExpression equalsExpression = new EqualsExpression(column, value); singleIndexExpression.addEqualsExpression(equalsExpression); byte[] bytes = IndexUtils.toBytes(singleIndexExpression); ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bis); SingleIndexExpression readExp = (SingleIndexExpression) ois.readObject(); assertEquals("idx1", readExp.getIndexName()); assertEquals(1, readExp.getEqualsExpressions().size()); assertTrue(Bytes.equals(value, readExp.getEqualsExpressions().get(0).getValue())); assertEquals(column, readExp.getEqualsExpressions().get(0).getColumn()); }