Java Array Sum sumRightShifts(int num, int... shifts)

Here you can find the source of sumRightShifts(int num, int... shifts)

Description

sum Right Shifts

License

Apache License

Declaration

public static int sumRightShifts(int num, int... shifts) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int sumRightShifts(int num, int... shifts) {
        if (shifts == null) {
            return num;
        }//from  w  ww .j  a  v a  2s.co  m
        int sum = 0;

        for (int shift : shifts) {
            sum += num >>> shift;
        }
        return sum;
    }
}

Related

  1. sumOfMeanDifferencesOnePoint(double[] vector)
  2. sumOfMinimum(double[] a, double[] b)
  3. sumOfProducts(double[]... nums)
  4. sumOverVector(float[] a)
  5. sumProd(double[] v1, double[] v2, int i_, int n_)
  6. sumSquared(double[] a)
  7. sumToDouble(float[] array)
  8. sumToLong(byte[] array)
  9. sumUpArray(int[] array)