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 short toUnsignedByte(byte bytes) {
        bb = ByteBuffer.allocate(1);
        bb.put(bytes);
        bb.order(ByteOrder.LITTLE_ENDIAN);
        return (short) (bb.get() & 0xff);
    }
}