Java Number Power pow(int[] arr, double p)

Here you can find the source of pow(int[] arr, double p)

Description

POW all elements of the specified primitive type array.

License

Open Source License

Parameter

Parameter Description
arr the array to be POW
p a parameter

Declaration

public static void pow(int[] arr, double p) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static void pow(int[] arr, double p) {
        for (int i = 0, l = arr.length; i < l; i++) {
            arr[i] = (int) Math.pow(arr[i], p);
        }//ww w .j  a v  a  2  s .c  om
    }

    public static void pow(double[] arr, double p) {
        for (int i = 0, l = arr.length; i < l; i++) {
            arr[i] = (double) Math.pow(arr[i], p);
        }
    }

    public static void pow(float[] arr, double p) {
        for (int i = 0, l = arr.length; i < l; i++) {
            arr[i] = (float) Math.pow(arr[i], p);
        }
    }

    public static void pow(long[] arr, double p) {
        for (int i = 0, l = arr.length; i < l; i++) {
            arr[i] = (long) Math.pow(arr[i], p);
        }
    }

    public static void pow(short[] arr, double p) {
        for (int i = 0, l = arr.length; i < l; i++) {
            arr[i] = (short) Math.pow(arr[i], p);
        }
    }

    public static void pow(byte[] arr, double p) {
        for (int i = 0, l = arr.length; i < l; i++) {
            arr[i] = (byte) Math.pow(arr[i], p);
        }
    }
}

Related

  1. pow(int leftOp, int rightOp)
  2. pow(int n, int p)
  3. pow(int number, int power)
  4. pow(int value, int exp)
  5. pow(int x, int y)
  6. pow(Integer a, Integer b)
  7. pow(long base, long exp)
  8. pow(long n, long pow)
  9. pow(long value, long pow)