hiiii please help me ....

i want java code....
my requirement is


The full rectangular area is first partitioned vertically or horizontally (chosen

randomly) into two equal rectangles. The sub-rectangles so formed are further

partitioned recursively, strictly alternating between horizontal and vertical. This

process is stopped when 8 rectangles formed.finally,one image will be loaded

in each rectangle area..so, the output becomes 8 images of different sizes concatenated each other.... i want java code.... please help me..