title: Java - How do I format a float before and while displaying it?
body: <p>I saw someone post this question recently, but because they received bad votes/comments, they took it down right when I was going to answer it. Since it isn't very popular on stackoverflow, and since people convinced the user that it couldn't be done, I have chosen to post a Q&amp;A on it.</p>
  
  <p>The question: How can I format a float to have four decimals? (i.e. 1.4056)</p>
  
  <p>For example, if the float is 1.8, it should display as 1.8000.
  And if the float is 1.56789, it should display as 1.5679.</p>