Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static Short bytesToInt16(byte bytes[]) {

        Integer value = 0;

        for (int i = 0; (i < 2 && i < bytes.length); ++i) {
            value = value | ((bytes[i] & 0x000000FF) << 8 * i);
        }

        return value.shortValue();
    }
}