About 727,000 results
Open links in new tab
  1. Getting random numbers in Java - Stack Overflow

    I would like to get a random value between 1 to 50 in Java. How may I do that with the help of Math.random();? How do I bound the values that Math.random() returns?

  2. How do I generate random integers within a specific range in Java ...

    With Java 8 they introduced the method ints(int randomNumberOrigin, int randomNumberBound) in the Random class. For example if you want to generate five random integers (or a single …

  3. how to use math.pi in java - Stack Overflow

    Sep 26, 2012 · how to use math.pi in java Asked 13 years, 1 month ago Modified 6 years, 1 month ago Viewed 582k times

  4. Why can't my program access the math methods in Java?

    May 22, 2013 · If a file is called Math.java (which it seems to be), it must contain a class called Math. Take a look at this post. Java is looking for a file called ./Math.java, which doesn't …

  5. Should I import a math library, and if so how? - Stack Overflow

    Feb 23, 2014 · E and PI are not functions, they're static fields (data members). That code will output their values correctly. You don't have to import anything, the Math class is in the …

  6. java - Math.random () explanation - Stack Overflow

    Nov 1, 2011 · This is a pretty simple Java (though probably applicable to all programming) question: Math.random() returns a number between zero and one. If I want to return an integer …

  7. what is the difference between the java.lang.Math class and the …

    The package java.math contains math related classes like BigDecimal.java and BigInteger.java While the class java.lang.Math is an actual Java class which resides in the packae 'java.lang'

  8. Is there a method that calculates a factorial in Java?

    May 21, 2009 · Quite nice idea. considering, that factorial first 20 is probably enough, i would add a static constants (no need to calculate it every time app launch) to Math class with those data …

  9. Is the Math class a standard class of Java? - Stack Overflow

    Oct 19, 2014 · I know that String, Integer and Double are standard classes of Java, but would Math fall into this category? You definitely do not have to import it like the Scanner class, …

  10. How to round a number to n decimal places in Java

    Sep 30, 2008 · Most of this are already in Java, with NumberFormat class. Use the factory method, like NumberFormat nf = NumberFormat.getNumberInstance(); and you can use it for …