Line Follower

I want to use a line follower to stop a motor when I reach a white line. How do i program that in iterative and java.