Java Integer Create toIntBE(byte[] src, int offset)

Here you can find the source of toIntBE(byte[] src, int offset)

Description

32bit to int

License

Open Source License

Declaration

public static final int toIntBE(byte[] src, int offset) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 Jens Kristian Villadsen.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html//from   ww w  . ja v  a 2  s  .com
 * 
 * Contributors:
 *     Jens Kristian Villadsen - Lead developer, owner and creator
 ******************************************************************************/

public class Main {
    /**
     * 32bit to int
     */
    public static final int toIntBE(byte[] src, int offset) {
        return (((src[offset] & 0xFF) << 24) + ((src[++offset] & 0xFF) << 16) + ((src[++offset] & 0xFF) << 8)
                + (src[++offset] & 0xFF));
    }
}

Related

  1. toIntArray(String value)
  2. toIntArray(String[] anArray)
  3. toIntArray(String[] array)
  4. toIntArray(String[] ss)
  5. toIntArrayUnshifted(byte... arguments)
  6. toIntBigEndian(byte[] input)
  7. toIntDecoded(String s)
  8. toIntDefaultIfNull(Integer configured, int theDefault)
  9. toInteger(boolean b)