You would have to know a lot about making meshes. There's not only the vertices, but the order in which each face is made. For normal faces, you need to order the vertices counter clockwise in your index data. If you understand that, you are more than half way there.
Use your array to determine "block" size. Start with the first "1" in your loop and any "1" touching it branches off to it's adjacent 1's and so on... Each "1" that is inside the "box" will be taken into account and turned into a "0". Once the "box" can go no further, you take the 3 dimensions and make a box (or you can just store that info in a memblock or whatever). Repeat that process until there are no more 1's.
Once there are no more 1's, you can make a single mesh using the data you gathered earlier. This may make what you are wanting to make, but it's not the easiest to do.... Have fun!
The fastest code is the code never written.