Android Byte Array to Int Convert extractInt(byte[] data, int offset)

Here you can find the source of extractInt(byte[] data, int offset)

Description

extract Int

License

Open Source License

Declaration

public static final int extractInt(byte[] data, int offset) 

Method Source Code

//package com.java2s;
/*/*from  ww  w .j  a  v a2s.  c om*/
 * Catverbs - A portable Catalan conjugation reference for Android
 * Copyright (C) 2014  Neil Roberts
 *
 * 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; version 2 of the License.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static final int extractInt(byte[] data, int offset) {
        return (((data[offset + 0] & 0xff) << 0)
                | ((data[offset + 1] & 0xff) << 8)
                | ((data[offset + 2] & 0xff) << 16) | ((data[offset + 3] & 0xff) << 24));
    }
}

Related

  1. swapU16bitFromArray(byte[] value, int offset)
  2. toInt(byte[] in)
  3. parseInt(byte[] b, int start, int end, int radix)
  4. parseInt(byte[] b, int start, int end)
  5. buildInt(byte first, byte second)
  6. ByteToInt(byte[] b)
  7. byteArray2Int(byte[] b)
  8. byteArray2Int1(byte[] b)
  9. byteArray2Int3(byte[] b)