So I generally know there are two ways to render a line one with bresehnams line algorithm and one with trigonometry.
double grad = Math.atan2((lineendx - linestartx),(lineendy - linestarty));
double xincrement = Math.sin(grad);
double yincrement = Math.cos(grad);