Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class test {
- public static int val;
- public static void main(String args[]) {
- ByteArrayOutputStream outgoingStream = new ByteArrayOutputStream();
- outgoingStream.write(1);
- outgoingStream.write(92);
- val = 23;
- outgoingStream.write(val);
- outgoingStream.write(34);
- val = 69;
- byte[] bytes = outgoingStream.toByteArray();
- ByteArrayInputStream in = new ByteArrayInputStream(bytes);
- for(int i = 0; i<bytes .length;i++) {
- //Outputs 1 92 23 34 but I need it as 1 92 69 34
- System.out.println(in.read());
- }
- }
- }
Add Comment
Please, Sign In to add comment