Created
July 8, 2018 15:29
-
-
Save hirokuma/c8a67b1db8e44ce45236942088d81865 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.BigDecimal; | |
public class Main { | |
public static void main(String[] args) { | |
//0xFEDCBA9876543210 | |
BigDecimal dec = new BigDecimal("18364758544493064720"); | |
BigDecimal div = dec.divide(new BigDecimal("72057594037927936")); | |
System.out.println("big decimal 2byte: " + Integer.toHexString(div.intValue())); | |
long decLong = 0xFEDCBA9876543210L; | |
System.out.println("long 2byte: " + Long.toHexString(decLong >>> 56)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment