Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    private static ByteBuffer bb;

    public static int toUnsignedShort(byte[] bytes) {
        bb = ByteBuffer.wrap(bytes, 0, bytes.length);
        bb.order(ByteOrder.LITTLE_ENDIAN);
        return bb.getShort() & 0xffff;
    }
}