title: How is an array stored in memory?
body: <p>In an interest to delve deeper into how memory is allocated and stored, I have written an application that can scan memory address space, find a value, and write out a new value.</p>
  
  <p>I developed a sample application with the end goal to be able to programatically locate my array, and overwrite it with a new sequence of numbers.  In this situation, I created a single dimensional array, with 5 elements, e.g.</p>
  
  <pre><code>int[] array = new int[] {8,7,6,5,4};
  </code></pre>
  
  <p>I ran my application and searched for a sequence of the five numbers above.  I was looking for any value that fell between 4 and 8, for a total of 5 numbers in a row.   Unfortunately, my sequential numbers within the array matched hundreds of results, as the numbers 4 through 8, in no particular sequence happened to be next to each other, in memory, in many situations.</p>
  
  <p>Is there any way to distinguish that a set of numbers within memory, represents an array, not simply integers that are next to each other?  Is there any way of knowing that if I find a certain value, that the matching values proceeding it are that of an array?</p>
  
  <p>I would assume that when I declare <code>int[] array</code>, its pointing at the first address of my array, which would provide some kind of meta-data to what existed in the array, e.g.</p>
  
  <blockquote>
  <pre><code>0x123456789 meta-data, 5 - 32 bit integers 
  0x123456789 + 32 "8"
  0x123456789 + 64 "7"
  0x123456789 + 96 "6"
  0x123456789 + 128 "5"
  0x123456789 + 160 "4"
  </code></pre>
  </blockquote>
  
  <p>Am I way off base?</p>