Print to console using System.out.write
<p>It is homework question.</p>

<p><strong>Question:</strong></p>

<blockquote>
  <blockquote>
    <p>"Use an array of integers with size 10 and print the content of the array using write( ) method.</p>
    
    <p>Note: Please do not use System.out.println( ) method."</p>
  </blockquote>
</blockquote>

<p>This is what I have tried so far, but it doesn't work.</p>

<pre><code>int i = 0;
while (i != array.length) {
  byte[] temp = new byte[4];
  temp[0] = (byte) (array[i] &amp; 256);
  array[i] = array[i] &gt;&gt; 8;
  temp[1] = (byte) (array[i] &amp; 256);
  array[i] = array[i] &gt;&gt; 8;
  temp[2] = (byte) (array[i] &amp; 256);
  array[i] = array[i] &gt;&gt; 8;
  temp[3] = (byte) (array[i] &amp; 256);
  System.out.write(temp, 0, 4);
  i++;
}
</code></pre>

<p>I can't find a way to do this, please help me out.</p>

<p>Thanks in advance. :)</p>
