Convert int to bytes - different result in Java & Actionscript <p>I would like to convert integers to bytes. I have an example in Actionscript and I need to convert it to Java. For the sake of simplicity let's assume only one number, 1234. This is my Java code:</p> <pre><code>int[] a = {1234}; ByteBuffer byteBuffer = ByteBuffer.allocate(a.length * 4); IntBuffer intBuffer = byteBuffer.asIntBuffer(); intBuffer.put(a); byte[] array = byteBuffer.array(); for (int i=0; i &lt; array.length; i++) { Log.i(T, i + ": " + array[i]); } </code></pre> <p>This gives me the following result:</p> <pre><code>0 : 0 1 : 0 2 : 4 3 : -46 </code></pre> <p>While in Actionscript I have this:</p> <pre><code>var c:ByteArray = new ByteArray; c.writeInt(1234); for(var p:uint=0; p&lt;c.length; p++) { trace(p+" : "+c[p]); } </code></pre> <p>And the result:</p> <pre><code>0 : 0 1 : 0 2 : 4 3 : 210 </code></pre> <p>What am I doing wrong, why is the result different? Thanks!</p>