Java Byte Array to Int bytesToInts(byte[] a, int ao, int[] b, int bo, int len)

Here you can find the source of bytesToInts(byte[] a, int ao, int[] b, int bo, int len)

Description

bytes To Ints

License

Open Source License

Declaration

public static final void bytesToInts(byte[] a, int ao, int[] b, int bo, int len) 

Method Source Code

//package com.java2s;
/**/*  w  w w .j a v a2 s.c om*/
  *         Commmon Internet File System Java API (JCIFS)
  *----------------------------------------------------------------
  *  Copyright (C) 1999  Norbert Hranitzky
  *
  *  This program is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU General Public License as
  *  published by the Free Software Foundation; either version 2 of
  *  the License, or (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  *  General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  *  The full copyright text: http://www.gnu.org/copyleft/gpl.html
  *
  *----------------------------------------------------------------
  *  Author: Norbert Hranitzky
  *  Email : norbert.hranitzky@mchp.siemens.de
  *  Web   : http://www.hranitzky.purespace.de
  */

public class Main {
    public static final void bytesToInts(byte[] a, int ao, int[] b, int bo, int len) {

        for (int i = 0; i < len; ++i)
            b[bo + i] = bytesToInt(a, ao + (i << 2));
    }

    public static final int bytesToInt(byte[] a, int aoffset) {
        return (a[aoffset] << 24) + ((a[aoffset + 1] & 0xff) << 16) + ((a[aoffset + 2] & 0xff) << 8)
                + (a[aoffset + 3] & 0xff);

    }
}

Related

  1. bytesToInt2(byte[] arr, int offset)
  2. bytesToIntArr(byte[] arr, int offset, int[] num, int soff, int size)
  3. bytesToInteger(byte[] b)
  4. bytesToInteger(byte[] b, int off)
  5. bytesToInteger(byte[] bytes)
  6. bytesToInts(byte[] bytes, int shift, int[] spec)
  7. bytesToInts(byte[] data)
  8. bytesToInts(byte[][] bytes)
  9. byteToInt(byte b[])