About 50 results
Open links in new tab
  1. What does the ^ operator do in Java? - Stack Overflow

    Jan 2, 2010 · It is the Bitwise xor operator in java which results 1 for different value of bit (ie 1 ^ 0 = 1) and 0 for same value of bit (ie 0 ^ 0 = 0) when a number is written in binary form.

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

    Sep 30, 2008 · What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next number. This is the …

  3. round up to 2 decimal places in java? - Stack Overflow

    Jul 28, 2012 · I have read a lot of stackoverflow questions but none seems to be working for me. i am using math.round () to round off. this is the code: class round { public static void main (String args []) { ...

  4. 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 between zero …

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

    Java 7+ In Java 1.7 or later, the standard way to do this (generate a basic non-cryptographically secure random integer in the range [min, max]) is as follows:

  6. How do I properly use the java.lang.Math? - Stack Overflow

    I believe I have imported the tool to allow the program to calculate basic math operations by using "java.lang.Math;" I understand * is multiplication, / is division, + is addition, - is subtraction, and % …

  7. hibernate - java.lang.ClassCastException: java.math.BigDecimal cannot ...

    java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Long Asked 6 years, 4 months ago Modified 6 years, 4 months ago Viewed 39k times

  8. How do you calculate log base 2 in Java for integers?

    Update: The Java 1.7 server JIT is able to replace a few static math functions with alternative implementations based on CPU intrinsics. One of those functions is Integer.numberOfLeadingZeros …

  9. Java rounding up to an int using Math.ceil - Stack Overflow

    Aug 21, 2011 · Java rounding up to an int using Math.ceil Asked 14 years, 5 months ago Modified 3 years, 4 months ago Viewed 218k times

  10. math - how to use ln in Java - Stack Overflow

    Apr 2, 2010 · I'm trying to use this formula in JAVA : (-ln(1-L))/L I'm not sure how to use ln in java.