Here you can find the source of swapByte(byte b)
static public int swapByte(byte b)
//package com.java2s; //License from project: Open Source License public class Main { static public int swapByte(byte b) { int high = (0x0000000F & ((int) b)); high = high << 4;//from w ww .j ava2s.c om int low = (int) b >> 4; return high + low; } }