Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Homework2;
- import java.util.*;
- public class FormattingNumbers {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int a = scan.nextInt();
- float b = scan.nextFloat();
- float c = scan.nextFloat();
- String hexA = Integer.toHexString(a);
- long binaryA = Long.parseLong(Integer.toBinaryString(a));
- System.out.printf("|%-10s|%010s|%10.2f|%-10.3f|", hexA, binaryA, b, c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement