Java Byte Array to Unsigned Int bytesToUnsignedInts(byte[] bytes)

Here you can find the source of bytesToUnsignedInts(byte[] bytes)

Description

bytes To Unsigned Ints

License

Apache License

Declaration

public static int[] bytesToUnsignedInts(byte[] bytes) 

Method Source Code

//package com.java2s;
/***/*w  w w.j a va2s .  c  om*/
  Copyright (c) 2012 sprogcoder <sprogcoder@gmail.com>
      
  Licensed under the Apache License, Version 2.0 (the "License"); you may
  not use this file except in compliance with the License. You may obtain
  a copy of the License at
      
http://www.apache.org/licenses/LICENSE-2.0
    
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 */

public class Main {
    public static int[] bytesToUnsignedInts(byte[] bytes) {
        int[] realvalues = new int[bytes.length];
        for (int i = 0; i < bytes.length; i++) {
            realvalues[i] = bytes[i] & 0xFF;
        }

        return realvalues;
    }
}

Related

  1. bytesToUint(byte first, byte second, byte third, byte fourth)
  2. bytesToUInt(final byte[] bytes, final int position, final int length, final int bitShiftStart, final int bitShitIncrement)
  3. bytesToUIntLE(byte[] data)
  4. bytesToUIntLong(byte[] bytes, int index)
  5. bytesToUnsignedInt(byte ib1, byte ib2)
  6. bytesToUshort(byte b1, byte b2)
  7. bytesToUshort(byte first, byte second)