code: public int sum() {
          int total = 0;
          int N = getNumElements();
          for (int i = 0; i < N; i++) {
              if( data[i] )
                  total += 1;
          }
          return total;
      }
docs: Returns the total number of elements which are true.
  @return number of elements which are set to true