About 28,300 results
Open links in new tab
  1. pow - Does Java have an exponential operator? - Stack Overflow

    3 days ago · Is there an exponential operator in Java? For example, if a user is prompted to enter two numbers and they enter 3 and 2, the correct answer would be 9. import java.util.Scanner; public class

  2. java - Writing a program calculating exponents - Stack Overflow

    Dec 13, 2012 · I'm trying to write a program that prints the results of the exponents of the number 2 and I want to print it out 10 times. I want to create a a method that calculates the value of the exponents us...

  3. Raising a number to a power in Java - Stack Overflow

    Dec 19, 2012 · ^ in java does not mean to raise to a power. It means XOR. You can use java's Math.pow()

  4. java - Calculating powers of integers - Stack Overflow

    Alternatively, The java.math.BigInteger.pow (int exponent) returns a BigInteger whose value is (this^exponent). The exponent is an integer rather than a BigInteger.

  5. 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. ex :- To use your example: The binary representation of 5 is 0101. The binary representation of 4 is 0100.

  6. how to get exponents without using the math.pow for java

    Apr 19, 2014 · I know this answer is very late, but there's a very simple solution you can use if you are allowed to have variables that store the base and the exponent. public class trythis {

  7. java - Recursive Exponent Method - Stack Overflow

    Create an auxiliary method to do the recursion. It should have two arguments: the base and the exponent. Call it with a value of 10 for the exponent and have it recurse with (exponent-1). The base case is exponent == 0, in which case it should return 1. (You can also use exponent == 1 as a base case, in which case it should return the base.)

  8. java - How to calculate exponent with loop? - Stack Overflow

    Nov 14, 2013 · Like you want. Here is an example of the output: Enter the base 56 Enter the base -4 Enter the base 4 Enter the power 67 Enter the power 10 Enter the power -8 Enter the power 7 4 to the 7th power is 16384 If the code snippets are confusing, here is the entire compilable, working class: import java.io.BufferedReader; import java.io ...

  9. How to express numbers in scientific notation in java?

    Nov 14, 2013 · Section 3.10.2 of the JLS talks about floating-point literals in Java. In short, provide the decimal part as if it were scientific notation, but instead of x 10^23 you would write e23: 3.30e23 To write one with a negative exponent, you can do that easily also for 6.67 x …

  10. Doing exponential operation using only addition in Java

    Mar 9, 2015 · I'm having trouble making this program. Is it possible to write a program by getting the exponential value without using *, ^, Math.pow? Example I have base of 2 and the exponent is 3. Q1. what operation should I used to help the addition to come up with the correct result? Q2. addition is enough?

Refresh