Here you can find the source of toIntsFromUBytes(byte[] byteArray)
Parameter | Description |
---|---|
byteArray | Array of "unsigned" bytes to be converted. |
public static int[] toIntsFromUBytes(byte[] byteArray)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww. j a va2 s .c o m * Convert an array of "unsigned" bytes to an array of ints, where values from 128 to 255 are mapped from -128 to -1. * * @param byteArray * Array of "unsigned" bytes to be converted. * @return Array of ints. */ public static int[] toIntsFromUBytes(byte[] byteArray) { if (byteArray == null) throw new NullPointerException(); int[] intArray = new int[byteArray.length]; for (int i = 0; i < byteArray.length; i++) intArray[i] = byteArray[i] & 0xFF; return intArray; } }