Java Integer Create toIntWithPrefix(byte prefix, byte[] bytes)

Here you can find the source of toIntWithPrefix(byte prefix, byte[] bytes)

Description

to Int With Prefix

License

Open Source License

Declaration

public static int toIntWithPrefix(byte prefix, byte[] bytes) 

Method Source Code

//package com.java2s;
/**/*from w ww .  j  a va2  s . c  om*/
 * Copyright 2012-2013 Johns Hopkins University HLTCOE. All rights reserved.
 * This software is released under the 2-clause BSD license.
 * See LICENSE in the project root directory.
 */

public class Main {
    public static int toIntWithPrefix(byte prefix, byte[] bytes) {
        assert (bytes[0] == prefix);
        assert (bytes.length >= 5);
        return (int) ((0xff & bytes[1]) << 24 | (0xff & bytes[2]) << 16 | (0xff & bytes[3]) << 8
                | (0xff & bytes[4]) << 0);
    }
}

Related

  1. toIntValue(final char ch)
  2. toIntValue(final Object o)
  3. toIntValue(Object number)
  4. toIntValueString(byte[] ip)
  5. toIntWithoutOverflow(float value)