SignatureUtils { static byte[] toByteArray(Object[] parameters) throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(parameters); out.flush(); return bos.toByteArray(); } finally { try { bos.close(); } catch (IOException ex) { } } }  static String sign(String metadata, String key); static String sign(Object[] parameters, String metadata, String key); static String sign(byte[] data, String key);  }
@Test void testObjectToByteArray() { try { byte[] bytes = SignatureUtils.toByteArray(objects); Assertions.assertNotEquals(0, bytes.length); } catch (Exception e) { e.printStackTrace(); } }