function value = ubvec_check ( n, ubvec )

%*****************************************************************************80
%
%% ubvec_check() checks an unsigned binary vector.
%
%  Discussion:
%
%    The only check made is that the entries are all 0 or 1.
%
%    A UBVEC is a vector of N binary digits.
%
%    A UBVEC can be interpreted as a binary representation of an
%    unsigned integer, with the first entry being the coefficient of
%    2^(N-1) and the last entry the coefficient of 1.
%
%    UBVEC   #
%    -----  --
%    00000   0
%    00001   1
%    00010   2
%    10000  16
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 November 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the length of the vectors.
%
%    integer UBVEC(N), the vector to be checked.
%
%  Output:
%
%    integer VALUE, is nonzero if an error occurred.
%
  value = 0

  for i = 1 : n
    if ( ubvec(i) < 0 || 2 <= ubvec(i) )
      value = i
      return
    end
  end

  return
end

