To implement the lines codes:
if steep then
swap(x0, y0)
swap(x1, y1)
if x0 > x1 then
swap(x0, x1)
swap(y0, y1)
from Bresenham Algorithms... it's correct to use a java swap method like this:
public void swap(int var1, int var2)
{
int temp = var1;
var1 = var2;
var2 = temp;
}