Guest User

Untitled

a guest
May 2nd, 2017
85
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Main {
  2.  
  3.     public static void main(String[] args) {
  4.    
  5.         double number = 123456789.123456789;
  6.         double number2 = 123.123456789;
  7.         double number3 = 123.456;
  8.        
  9.         printNumber(number);
  10.         printNumber(number2);
  11.         printNumber(number3);
  12.     }
  13.  
  14.     private static void printNumber(double number) {
  15.         String formattedNumber = String.format("%.15f", number);
  16.         System.out.printf("%.15s", formattedNumber);
  17.         System.out.println();
  18.     }
  19. }
RAW Paste Data