Here you can find the source of toInt(byte[] bytes)
convert int from byte array
Parameter | Description |
---|---|
bytes | a parameter |
public static int toInt(byte[] bytes)
//package com.java2s; public class Main { /**//from www . j a v a2s. c o m * <p>convert int from byte array</p> * * @param bytes * @return */ public static int toInt(byte[] bytes) { int result = 0; for (int i = 0; i < 4; i++) { result = (result << 8) - Byte.MIN_VALUE + (int) bytes[i]; } return result; } }