test/java/lang/Double/ToHexString.java
Print this page
@@ -23,15 +23,18 @@
/*
* @test
* @bug 4826774 4926547
* @summary Tests for {Float, Double}.toHexString methods
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils
+ * @run main ToHexString
* @author Joseph D. Darcy
*/
import java.util.regex.*;
-import sun.misc.DoubleConsts;
+import static jdk.testlibrary.DoubleUtils.*;
public class ToHexString {
private ToHexString() {}
/*
@@ -78,14 +81,14 @@
result.append("NaN");
}
else { // finite value
// Extract exponent
int exponent = Integer.parseInt(transString.substring(0,3), 16) -
- DoubleConsts.EXP_BIAS;
+ EXP_BIAS;
result.append("0x");
- if (exponent == DoubleConsts.MIN_EXPONENT - 1) { // zero or subnormal
+ if (exponent == Double.MIN_EXPONENT - 1) { // zero or subnormal
if(signifString.equals("0000000000000")) {
result.append("0.0p0");
}
else {
result.append("0." + signifString.replaceFirst("0+$", "").replaceFirst("^$", "0") +