Java Integer to intToUnsignedLong(int data)

Here you can find the source of intToUnsignedLong(int data)

Description

Converts the given integer value to an unsigned long number.

License

Open Source License

Parameter

Parameter Description
data the int type value to convert.

Return

An unsigned long number representing the given int number.

Declaration

public static long intToUnsignedLong(int data) 

Method Source Code

//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);
    }
}

Related

  1. intToUByte(int i)
  2. intToULong(int signed)
  3. intToUnsigned(int signed)
  4. intToUnsignedByte(int i)
  5. intToUnsignedInt(int data)
  6. intToUnsignedShort(int value)
  7. intToWeb(int color)
  8. intToZigZag(final int n)