Here you can find the source of getShortBE(ByteBuffer b, int start, int end)
public static short getShortBE(ByteBuffer b, int start, int end)
//package com.java2s; /*//w w w .j a v a2 s . co m * Entagged Audio Tag library * Copyright (c) 2003-2005 Rapha?l Slinckx <raphael@slinckx.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import java.nio.ByteBuffer; public class Main { public static short getShortBE(ByteBuffer b, int start, int end) { return (short) getIntBE(b, start, end); } public static int getIntBE(byte[] b, int start, int end) { return (int) getLongBE(ByteBuffer.wrap(b), start, end); } public static int getIntBE(ByteBuffer b, int start, int end) { return (int) getLongBE(b, start, end); } public static long getLongBE(ByteBuffer b, int start, int end) { int number = 0; for (int i = 0; i < (end - start + 1); i++) { number += ((b.get(end - i) & 0xFF) << i * 8); } return number; } }