Java examples for Internationalization:Charset
to Big Endian Short
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { byte[] b = new byte[] { 34, 35, 36, 37, 37, 37, 67, 68, 69 }; int pos = 2; System.out.println(toBigEndianShort(b, pos)); }/*from w ww . j av a2 s.c om*/ public static short toBigEndianShort(byte[] b, int pos) { short ret = 0; ret |= (b[pos] & 0xFF) << 8; ret |= (b[pos + 1] & 0xFF); return ret; } }