Created
July 8, 2018 15:27
-
-
Save hirokuma/f365c2a85dae3962ff3d5f19562b9029 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
public class Main { | |
static void func(long value) { | |
BigInteger val = new BigInteger(Long.toHexString(value), 16); | |
System.out.println("BigInteger: " + val); | |
BigInteger byteVal = val.shiftRight(56); | |
System.out.println("BigInteger 2byte: " + byteVal); | |
} | |
public static void main(String[] args) { | |
long decLong = 0xFEDCBA9876543210L; | |
System.out.println("long: " + decLong); | |
System.out.println("long 2byte: " + (decLong >> 56)); | |
func(decLong); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment