Guest User

Untitled

a guest
Jun 24th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public class test {
  2. public static int val;
  3. public static void main(String args[]) {
  4.  
  5. ByteArrayOutputStream outgoingStream = new ByteArrayOutputStream();
  6. outgoingStream.write(1);
  7. outgoingStream.write(92);
  8. val = 23;
  9. outgoingStream.write(val);
  10. outgoingStream.write(34);
  11. val = 69;
  12.  
  13.  
  14. byte[] bytes = outgoingStream.toByteArray();
  15.  
  16. ByteArrayInputStream in = new ByteArrayInputStream(bytes);
  17.  
  18. for(int i = 0; i<bytes .length;i++) {
  19. //Outputs 1 92 23 34 but I need it as 1 92 69 34
  20. System.out.println(in.read());
  21. }
  22. }
  23.  
  24. }
Add Comment
Please, Sign In to add comment