fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.nio.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. // your code goes here
  14. byte[] bytes = new byte[2];
  15. bytes[0] = 10;
  16. bytes[1] = 20;
  17.  
  18. ByteBuffer buf = ByteBuffer.wrap(bytes);
  19.  
  20. System.out.println("byte: " + bytes[0] + " vs buf " + buf.get(0));
  21.  
  22. bytes[0] = 33;
  23.  
  24. System.out.println("byte: " + bytes[0] + " vs buf " + buf.get(0));
  25. }
  26. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
byte: 10 vs buf 10
byte: 33 vs buf 33