Here you can find the source of getByteNetOrderTo_unit16(byte[] theBytes, int idx)
Parameter | Description |
---|---|
theBytes | - the array |
idx | - the starting index |
public static int getByteNetOrderTo_unit16(byte[] theBytes, int idx)
//package com.java2s; public class Main { /**/* w ww. j a v a 2s . co m*/ * pull out unsigned 16 bits integer out of the array. * @param theBytes - the array * @param idx - the starting index * @return the num (0-65535) */ public static int getByteNetOrderTo_unit16(byte[] theBytes, int idx) { int sum = 0; for (int i = 0; i < 2; i++) { sum = (sum << 8) + (0xff & theBytes[i + idx]); } return sum; } }