title: How to round a user input in Java
body: <p>I'm attempting to get a user input of a decimal, then round it to two decimal points. This is the code I currently have which is not working correctly, and I'm not sure why.</p>
  
  <pre><code>package code;
  import java.math.RoundingMode;
  import java.text.DecimalFormat;
  import java.util.Scanner;
  public class DecimalPlaces {
  
      public static void main(String[] args) {
          DecimalFormat df = new DecimalFormat("#.##");
          df.setRoundingMode(RoundingMode.CEILING);
          Scanner qweInput = new Scanner(System.in);
          System.out.println("Enter a decimal number:");
          String qwe1 = qweInput.next();
          df.format(qwe1);
          System.out.println(qwe1);
          }
  
  }
  </code></pre>