Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static byte[] shortToByteArray(int value) {
        ByteBuffer bb = ByteBuffer.allocate(2);
        bb.order(ByteOrder.LITTLE_ENDIAN);
        bb.putShort((short) value);
        return bb.array();
    }
}