function i4_and_test ( )

%*****************************************************************************80
%
%% i4_and_test() tests i4_and().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 January 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4_and_test():\n' );
  fprintf ( 1, '  i4_and() returns the bitwise AND of two integers.\n' );
  fprintf ( 1, '  MATLAB provides a BITAND operator.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '       I       J  I4_AND  BITAND\n' );
  fprintf ( 1, '\n' );

  for test = 1 : 10

    i = randi ( [ 0, 100 ], 1 );
    j = randi ( [ 0, 100 ], 1 );
    k = i4_and ( i, j );
    l = bitand ( i, j );

    fprintf ( 1, '  %6d  %6d  %6d  %6d\n', i, j, k, l );

  end 

  return
end
