title: Printing Boolean Array in Java
body: <p>How can i print prime from main function.
  My code is given below...</p>
  
  <pre><code>public static boolean[] sieve(int n) {
      boolean[] prime = new boolean[n+1];
      Arrays.fill(prime, true);
      prime[0] = false;
      prime[1] = false;
      int m = (int) Math.sqrt(n);
  
      for (int i = 2; i &lt; m; i++) {
          if (prime[i])
              for (int k=i*i; k&lt;=n; k+=i )
                  prime[k] = false;
      }
      return prime;
  }
  </code></pre>