alternative way to compare if three ints are equal

Viewed 22559
int a = 10;
int b = 10;
int c = 10;

I am trying to find out if there is alternate way to compare if three ints or anything are equal.

The way i am currently doing is

if( (a == b) && (a == c) && (b == c)){

}

I was wondering if there is an alternate and more concise way to do this.

4 Answers
public static int equal(int a, int b, int c) {
    int count = 0;

    if (a==b && b==c) { 
      count = 3; 
    } else if ((a==b && b!=c) || (a==c && a!=b)) { 
      count = 2; 
    }

    return count;
}
Related