Java BigInteger to toUnsigned(final BigInteger[] ulong)

Here you can find the source of toUnsigned(final BigInteger[] ulong)

Description

to Unsigned

License

Open Source License

Declaration

public static long[] toUnsigned(final BigInteger[] ulong) 

Method Source Code

//package com.java2s;
/*/*from   www . j  a  v  a  2 s  . c  o m*/
 * This file is protected by Copyright. Please refer to the COPYRIGHT file 
 * distributed with this source distribution.
 * 
 * This file is part of REDHAWK core.
 * 
 * REDHAWK core is free software: you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by the 
 * Free Software Foundation, either version 3 of the License, or (at your 
 * option) any later version.
 * 
 * REDHAWK core 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 Lesser General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License 
 * along with this program.  If not, see http://www.gnu.org/licenses/.
 */

import java.math.BigInteger;

public class Main {
    public static short[] toUnsigned(final int[] ushort) {
        final short[] retVal = new short[ushort.length];
        for (int i = 0; i < retVal.length; i++) {
            retVal[i] = toUnsigned(ushort[i]);
        }
        return retVal;
    }

    public static int[] toUnsigned(final long[] uint) {
        final int[] retVal = new int[uint.length];
        for (int i = 0; i < retVal.length; i++) {
            retVal[i] = toUnsigned(uint[i]);
        }
        return retVal;
    }

    public static long[] toUnsigned(final BigInteger[] ulong) {
        final long[] retVal = new long[ulong.length];
        for (int i = 0; i < retVal.length; i++) {
            retVal[i] = toUnsigned(ulong[i]);
        }
        return retVal;
    }

    public static short toUnsigned(final int ushort) {
        return (short) ushort;
    }

    public static int toUnsigned(final long uint) {
        return (int) uint;
    }

    public static long toUnsigned(final BigInteger ulong) {
        return ulong.longValue();
    }
}

Related

  1. toPaddedBytes(BigInteger bi, int length)
  2. toPushbackReader(BigInteger x)
  3. toStr(BigInteger number)
  4. toString(BigInteger bi)
  5. toString(BigInteger[] vector)
  6. toUnsignedBigInteger(long i)
  7. toUnsignedBigInteger(long number)