Moving two rectangles using timer

In the langauge of Java. I need to create a program that prints the position of two rectangles every 5 seconds both using a timer. But one rectangle should be moving twice as fast as the other one. So in the console it would just print:

rectangle A position is 2 rectangle B position is 4 rectangle A position is 4 rectangle B position is 16 ...and it goes on..

I am not sure what to do or where to start at all. Someone help.

I've created a loop that prints the time every second but I do not know where to go from here.