title: Using int, double and long in calculation of powers
body: <p>I'm having trouble figuring out when to use int, double and long. </p>
  
  <p>I'm working on calculating the power of an integer and return the result as long as the power provided is not a negative number. </p>
  
  <p>For the assignment, I'm required to use the following code to start: </p>
  
  <pre><code>public static long powerN(int number, int power) {
  </code></pre>
  
  <p>Here's what I came up with: </p>
  
  <pre><code>public class PowerCalculator
  {
  /**
   * Calculate the non-negative power of an integer number. If a negative power is input, the method returns 1.
   * 
   * @param number The number to take power.
   * @param power The power factor to be taken to.
   * @return The calculation result after taking power of the integer number.
   */
      public static long powerN(int number, int power) {
  
         if (power &gt; 0)
         {  
           double result = (Math.pow(number, power));  
           return result; 
         }
         else 
         {
           return 1; 
         }
      }
  }
  </code></pre>
  
  <p>I know I'm messing up the use of int, double or long but I don't know how to fix it. </p>