@@ -0,0 +1,1372 @@
+package chapter_5;%0A%0Apublic class DrawLine %7B%0A%0A  public String drawLine(byte%5B%5D screen, int width, int x1, int x2, int y) %7B%0A    if (x1 %3E= width %7C%7C x2 %3E= width) %7B%0A      return printScreen(screen, width);%0A    %7D%0A%0A    int startIndex = (x1 %25 8);%0A    int startArrIndex = ((y * width) + x1) / 8;%0A    int lineLength = (x2 - x1) + 1;%0A    while (lineLength %3E 0) %7B%0A      int j = (8 - startIndex - 1), i = 0;%0A      if ((startIndex + lineLength) %3E= 8) %7B%0A        i = 0;%0A        lineLength -= (8 - startIndex);%0A      %7D else %7B%0A        i = lineLength - 1;%0A        lineLength = 0;%0A      %7D%0A      screen%5BstartArrIndex%5D = (byte) (screen%5BstartArrIndex%5D %7C fetchMask(i, j));%0A      startIndex = 0;%0A      startArrIndex++;%0A    %7D%0A%0A    return printScreen(screen, width);%0A  %7D%0A%0A  private String printScreen(byte%5B%5D screen, int width) %7B%0A    StringBuilder builder = new StringBuilder();%0A    for (int i = 0; i %3C screen.length; i++) %7B%0A      builder.append(Integer.toBinaryString(screen%5Bi%5D & 255 %7C 256).substring(1));%0A      if ((((i + 1) * 8) %25 width) == 0) %7B%0A        builder.append(%22%5Cn%22);%0A      %7D%0A    %7D%0A    return builder.toString();%0A  %7D%0A%0A  private byte fetchMask(int i, int j) %7B%0A    return (byte) ((~0 %3C%3C i) & ((1 %3C%3C (j + 1)) - 1));%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    // System.out.println(Integer.toBinaryString(fetchMask(0, 6)));%0A    new DrawLine().drawLine(new byte%5B8%5D, 16, 0, 7, 2);%0A  %7D%0A%7D%0A

Add my crappy solution to DrawLine, TODO: Cleanup this code