I am writing a code that will use numbers from an array and add them up. I only have doubles that have two decimals but i still get over 6 decimal numbers. How can i fix this? My code currently consists of;
 //this is the array where I'll be getting the numbers from
public static double[] prijzen = new double[]{2.20,3.70,4.20,0.50,2.60,1.80}; 
//double where the numbers will be added and stored
public static double totaal = 0; 
 // a method that will calculate the total for me
 public static double TotaalPrijs(double x)
{
  totaal = totaal + x;  
  return totaal;
 }
the method will be activated upon a press of a JButton. The code for one of those buttons looks like this
  private void BtnFrisdrankActionPerformed(java.awt.event.ActionEvent evt) 
  {                                             
    double prijs = prijzen[0]; 
    TotaalPrijs(prijs);
  }
