Here you can find the source of toInt(byte[] n)
Parameter | Description |
---|---|
n | a parameter |
public static int toInt(byte[] n)
//package com.java2s; /*/*from ww w .j av a 2 s . c o m*/ * Copyright 05-abr-2014 ?Deme * * This file is part of 'dmLang-8.1.0'. * * 'dmLang-8.1.0' 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 3 of the License. * * 'dmLang-8.1.0' 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 'dmLang-8.1.0'. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Converter * * @param n * @return */ public static int toInt(byte[] n) { int a = n[0]; if (a < 0) { a += 256; } int b = n[1]; if (b < 0) { b += 256; } int c = n[2]; if (c < 0) { c += 256; } int d = n[3]; if (d < 0) { d += 256; } return a + b * 256 + c * 65536 + d * 16777216; } }