IntegerConvertToLong(NotINegetive)

今天遇到了Integer转换为非负Long型

 

我在这里实现了一下嘿嘿:

 

package com.chenhailong;

import java.math.BigInteger;

/**
 * 
 * @author chenhailong
 *下午09:02:00
 *com.chenhailong
 */
public class Main {

    public static void main(String[] args) {

        Long longValue = new Long(4294967295L);
        Integer intValue = new BigInteger(Long.toHexString(longValue), 16).intValue();
        System.out.println(intValue);

        Integer intValueLast = new Integer(intValue);
        Long longValueLast = new BigInteger(Integer.toHexString(intValueLast), 16).longValue();
        System.out.println(longValueLast);
    }
}

 

你可能感兴趣的:(Integer)