convert a bytearray to a 2-dimensional intarray
<p>can someone help to write a method that converts a byte array to a 2-dimensional int array?!</p>

<p>I have written that:</p>

<pre><code>internal int[][] byteToInt(byte[] byteArray)
    {
        int width = (int)Math.Sqrt(byteArray.Length);
        int[][] tmp = new int[width][];
        for (int i = 0; i &lt; width; i++)
        {
            tmp[i] = new int[width];
        }
        for (int i = 0; i &lt; width; i++)
        {
            for (int j = 0; j &lt; width; j++)
            {
                tmp[i][j]=(int)byteArray[(i*width+j)];
            }
        }
        return tmp;
    }
</code></pre>

<p>but that is not working properly....</p>
