IRusev

Problem 6. Formatting Numbers

Sep 9th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import java.util.*;
  2. import org.apache.commons.lang3.StringUtils;
  3.  
  4. public class FormattingNumbers
  5. {
  6. public static void main(String[] args)
  7. {
  8. Scanner input = new Scanner(System.in);
  9.  
  10. int a = input.nextInt();
  11. float b = input.nextFloat();
  12. float c = input.nextFloat();
  13. System.out.printf("|%1$10X|%2$s|%3$10.2f|%4$-10.3f|" + "\r\n", a, StringUtils.leftPad(Integer.toBinaryString(a), 10, '0'), b, c);
  14. input.close();
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment