Here you can find the source of getAs_uint16_NetOrder(int theNumber)
Parameter | Description |
---|---|
theNumber | a parameter |
public static byte[] getAs_uint16_NetOrder(int theNumber)
//package com.java2s; public class Main { /**/*from www. j a va 2 s . c om*/ * turn 16 bits unsigned integer number to byte array representing the number * in network order. * @param theNumber * @return byte array * (int in java is 4 bytes here only the lower 2 bytes are counted) */ public static byte[] getAs_uint16_NetOrder(int theNumber) { byte[] toReturn = new byte[2]; toReturn[0] = (byte) (theNumber & 0xf0); toReturn[1] = (byte) (theNumber & 0x0f); return toReturn; } }