Hello and welcome to the forum!
Can you be more specific please?
Can you post your entire code please? Where are you stuck?
Book
there is a nice online book with multiple chapters: Collision Detection
You can browse the book with the small arrows left and right on top of each page
In general
In general, when you have rectangles or balls in your array (as objects derived from a class?) you want to for-loop over the array and compare each ball with the ones after it in the array:
// Good
for(int i=0; i<list.length-1; i++) {
for(int i2=i+1; i2<list.length; i2++) {
if(list[i] .... list [i2]..... // check collision
I mention that because some beginners compare every ball with every other ball (bad) which checks each pair twice and not only once:
// BAD
for(int i=0; i<list.length; i++) {
for(int i2=0; i2<list.length; i2++) {
if(list[i] .... list [i2]..... // check collision
Links
see Bouncy Bubbles / Examples / Processing.org
see Circle Collision with Swapping Velocities / Examples / Processing.org
Warm regards,
Chrisir 