Convert float value to Hex String value

ReturnMethodSummary
static StringtoHexString(float f)Returns a hexadecimal string representation of the float argument.

public class Main {
  public static void main(String[] args) {
    Float floatObject2 = Float.valueOf(1.1F);
    System.out.println(floatObject2);
    System.out.println(Float.toHexString(floatObject2));
    
  }
}

The output:


1.1
0x1.19999ap0
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.