Jump to content

doubles places past decimal....

- - - - -

  • Please log in to reply
1 reply to this topic

#1
oldezwe

oldezwe

    Newbie

  • Members
  • Pip
  • 8 posts

import java.text.*;

import java.util.Random;

import java.util.Iterator;

import java.util.List;

import java.util.ArrayList;


public final class RandomGaussian {

  

  public static final void main(String... aArgs){

	  Random randomGenerator = new Random();

	  List<Integer> level = new ArrayList<Integer>();

	  level.add(37);

      level.add(56);

      level.add(22);

      level.add(19);

      

      

      int position = 0;

      int listsize = level.size();

      while(position < listsize){

      double randDouble = randomGenerator.nextInt(level.get(position));

      log("Generated : " + randDouble);

      position = position + 1;

      


      }

      

      log("Done.");

  }

  

  private static void log(String aMessage){

    System.out.println(aMessage);

  }

}


How do I get the doubles I print out to go 10 places past the decimal?

#2
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
Try this,
Decimal Format : Double « Data Type « Java Tutorial

~ Committed.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users