fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static int toInt16(byte high, byte low) {
  11. int res = (high << 8);
  12. res |= (low & 0xFF);
  13. return res & 0xFFFF;
  14. }
  15. public static void main (String[] args) throws java.lang.Exception
  16. {
  17. byte[] b = new byte[] {(byte)0x05, (byte)0xE0};
  18. int a = toInt16(b[0], b[1]);
  19. System.out.println(Integer.toString(a, 16));
  20. }
  21. }
Success #stdin #stdout 0.1s 320320KB
stdin
Standard input is empty
stdout
5e0