function bvec = i4_to_bvec ( i4, n )

%*****************************************************************************80
%
%% I4_TO_BVEC converts an integer into a binary vector.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    19 March 2009
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer I4, the integer.
%
%    Input, integer N, the dimension of the vector.
%
%    Output, integer BVEC(N), the vector of binary remainders.
%
  bvec(1:n) = 0;

  for i = n : -1 : 1
    bvec(i) = mod ( i4, 2 );
    i4 = floor ( i4 / 2 );
  end

  return
end
