Here you can find the source of swap(int elementWidth, long value)
private static long swap(int elementWidth, long value)
//package com.java2s; //License from project: Open Source License public class Main { private static long swap(int elementWidth, long value) { return Long.reverseBytes(value) >>> (8 * (8 - elementWidth)); }// ww w . jav a 2 s.c om }