fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. Scanner sc= new Scanner(System.in);
  14. String[] tab= sc.nextLine().split(" ");
  15. int numberOfTests = Integer.parseInt( tab[0] );
  16. float f1=0;
  17.  
  18. for (int i=0; i<numberOfTests; i++) {
  19. tab=sc.nextLine().split(" ");
  20. f1= Float.parseFloat(tab[0]);
  21.  
  22. printfloat( f1 );
  23.  
  24. }
  25.  
  26. sc.close();
  27. }
  28.  
  29.  
  30.  
  31. public static void printfloat(float f) {
  32.  
  33. if (f==0) System.out.println("0 0 0 0");
  34. else {
  35.  
  36. String st1 = Integer.toHexString( Float.floatToIntBits( f ) );
  37. st1= st1.replaceFirst("(\\w{2})(\\w{2})(\\w{2})(\\w{2})" ,"$1 $2 $3 $4");
  38.  
  39. st1= st1.replaceAll("00", "0" );
  40.  
  41. System.out.println(st1);
  42. }
  43.  
  44. }
  45.  
  46. }
Success #stdin #stdout 0.1s 35464KB
stdin
2
0
1
stdout
0 0 0 0
3f 80 0 0