Collision detection is a very huge topic. Probably you would be okay with a very small and simple collision detector but currently it seems you can't write one for yourself and I doubt that you want to read a book on collision detection or want to learn the difficult math to solve your problem. Collision detection is a core part of game physics engines. Besides this physics engines contain other things too that enables you to simulate the movement of your objects in the world so that it looks "real". A good game physics engine allows you to create objects with different simple geometries (circle, rectangle, line) inside the world of the game physics engine and allows you to set the properties of those objects (mass, friction, elasticy, ...), creating forces (drag force, per object force, ...) that act on these objects, connect these objects, etc... Then when you are done you can "step"/update your physics world with a specified amount of time. If you created a circle in the air with a nonzero mass, then updating 2 seconds on your physics world will move this circle towards the ground (if you have set up a ground and a gravity force in your world or it has these by default...). If the circle reaches the ground and you set up correct parameters the circle may jump back from the ground like a ball. So for each of your movable objects of your engine you have to create an accompanying physics object in the physics engine world. When you update the state of your game in your main update (lets say with 1/30 seconds) then you first you update your physics engine and it tells you where to move your objects in your own engine. You can define circle or rectangle or whatever shape for your sprites in the physics world with whatever physical parameters to make them bouncing or behave like 100kg metal balls.
A physics engine may look like a heavy-weight solution to your simple problem but I still recommend you to learn and use one because: Writing a good physics engine is extremely difficult and you can put together cool games/programs without knowing how to write one just by being able to use one of them. As a 2D physics engine I would recommend you to explore the java port of the Box2D physics engine:
http://www.jbox2d.org/[
^]
Have fun!!! Playing around with a physics engine in 2D is already fun! Check out the demo .jar file on the linked site! The demo doesn't contain superb graphics but skinning a scene and detecting collision with a physics system is a no brainer.