Java Array Equal allEqual(int[] arr)

Here you can find the source of allEqual(int[] arr)

Description

Returns true if all values in the array are equal.

License

Open Source License

Declaration

public static boolean allEqual(int[] arr) 

Method Source Code

//package com.java2s;

public class Main {
    /** Returns true if all values in the array are equal. Args: Array */
    public static boolean allEqual(int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[0] != arr[i])
                return false;
        }//from w w  w  .j a  v a 2 s .c o  m
        return true;
    }
}

Related

  1. allEqual(int[] values)
  2. allEquals(double[][] sims)
  3. allEquals(final String value, final String... strings)
  4. allEquals(int needle, byte... bytes)