Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import java.util.BitSet;
  2. import java.util.Locale;
  3. import java.util.Scanner;
  4.  
  5.  
  6. @SuppressWarnings("unused")
  7. public class _06_FormattingNumbers {
  8. public static void main(String[] args) {
  9. Locale.setDefault(Locale.ROOT);
  10.  
  11. @SuppressWarnings("resource")
  12. Scanner str = new Scanner(System.in);
  13. int a = str.nextInt();
  14. float b = str.nextFloat();
  15. float c = str.nextFloat();
  16. System.out.printf("|%-10X", a);
  17. System.out.printf(String.format("|%10s|", Integer.toBinaryString(a)).replace(" ", "0"));
  18. System.out.printf("%10.2f|", b);
  19. System.out.printf("%-10.3f|", c);
  20.  
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement