Here you can find the source of intToUnsignedLong(int data)
Converts the given integer value to an unsigned long number.
Parameter | Description |
---|---|
data | the int type value to convert. |
public static long intToUnsignedLong(int data)
//package com.java2s; /*/*from w w w .j av a 2 s .c o m*/ * This file is part of SerialPundit. * * Copyright (C) 2014-2016, Rishi Gupta. All rights reserved. * * The SerialPundit is DUAL LICENSED. It is made available under the terms of the GNU Affero * General Public License (AGPL) v3.0 for non-commercial use and under the terms of a commercial * license for commercial use of this software. * * The SerialPundit 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. */ public class Main { /** * <p>Converts the given integer value to an unsigned long number. The least significant 4 bytes * (32 bits) of the long number will be identical to the least significant 4 bytes (32 bits) of the * integer number and the most significant 4 bytes (32 bits) of the long number will be zero.</p> * * @param data the int type value to convert. * @return An unsigned long number representing the given int number. */ public static long intToUnsignedLong(int data) { return 0x00000000ffffffff & ((long) data); } }