Guest User

Untitled

a guest
Mar 17th, 2016
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1.  
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Problem3FormattingNumbers {
  6. public static void main(String[] args) {
  7. Scanner console = new Scanner(System.in);
  8. int a = console.nextInt();
  9. double b = console.nextDouble();
  10. double c = console.nextDouble();
  11.  
  12. String hexadecimal = Integer.toHexString(a).toUpperCase();
  13. String binary = Integer.toBinaryString(a);
  14.  
  15. System.out.printf("|%1$-10s|%2$010d|%3$10.2f|%4$-10.3f| ", hexadecimal, Integer.parseInt(binary), b, c);
  16. }
  17. }
Add Comment
Please, Sign In to add comment