Here you can find the source of switchEndian(short i)
public static final short switchEndian(short i)
//package com.java2s; public class Main { public static final long switchEndian(long l) { return (l >>> 56) | ((l >>> 40) & 0x0000FF00) | ((l >>> 24) & 0x00FF0000) | ((l >>> 8) & 0xFF000000L) | ((l & 0xFF000000L) << 8) | ((l & 0x00FF0000) << 24) | ((l & 0x0000FF00) << 40) | (l << 56); }//from w ww. j a va 2s .c o m public static final int switchEndian(int i) { return ((i & 0xff000000) >>> 24) | ((i & 0x00ff0000) >>> 8) | ((i & 0x0000ff00) << 8) | ((i & 0x000000ff) << 24); } public static final short switchEndian(short i) { return (short) (((i & 0xff00) >>> 8) | ((i & 0x00ff) << 8)); } }