title: Java - Returning the smallest element of the given non-empty array
body: <p>I am studying Java and trying to find the bug in my code.</p>
  <p>It is suppose to return the smallest element of the given non-empty array.</p>
  <p>It works with B = [-3, 4, -2, -2]</p>
  <p>Can you tell me what I am doing wrong here?</p>
  <pre><code>class Test {
      int test(int[] B, int[] C) {
          int ans = 0;
          for (int i = 1; i &lt; B.length; i++) {
              if (ans &gt; B[I]) {
                  ans = B[i];
              }
          }
          return ans;
      }
  }
  </code></pre>