Array is Balanced Array or Not
An alternative way could be using a map, the average lookup time should be O(1) so this algorithm would be O(n) on average.

public static boolean isBalanced(int[] a) 
{     
    Map&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;();  
    for(int number : a)
    {   
        int key = Math.abs(number);
        Integer value = map.get(key);

        if(value == null)
            map.put(key, number);
        else if (value != number)
            map.put(key, 0);
    }   
    for (int v : map.values())
    {
        if(v != 0) return false;
    }

    return true;
}


A more readable version in java 8 ( Autoboxing and unboxing may hurt the performance a lot thought.)

 public static boolean isBalanced(int[] a) 
 {


       Map&lt;Integer, Integer&gt; map = Arrays.stream(a)
                                         .boxed()
                                         .collect(Collectors.toMap(
                                                 Math::abs,
                                                 Function.identity(),
                                                 (x, y) -&gt; x.equals(y)? x: 0 )
                                         );
        return map.values()
                  .stream()
                  .allMatch(p -&gt; p == 0);
 }