Guest User

Untitled

a guest
Oct 17th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. public byte[] getByteArray(String data) {
  2.  
  3. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  4. DataOutputStream out = new DataOutputStream(byteArrayOutputStream);
  5.  
  6. try {
  7. out.write(data.getBytes());
  8. byteArrayOutputStream.flush();
  9. byteArrayOutputStream.close();
  10. } catch (IOException e) {
  11. e.printStackTrace();
  12. }
  13.  
  14. return byteArrayOutputStream.toByteArray();
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment