import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.BitSet;
import java.util.Scanner;

public class PoetryBot
{
	public static int POETRYBOTVERSION = 1;

	private void run()
	{
		Scanner listener = new Scanner(System.in);

		System.out.println("Hello! I am Poetry Bot.");
		
		System.out.println("I am poetry bot #" + POETRYBOTVERSION);
		
		System.out.println();

		System.out.print("What would you like me to write about? ");
		String input = listener.nextLine();
		System.out.println();
		
		System.out.println("I will write about " + '"' + input + '"' + ".");
		
		byte[] hash = getSHA512(input);
		
		BitSet foo = getBits(hash);
		
		printBitSet(foo);
		
		listener.close();
	}
	
	private static void printBitSet(BitSet b)
	{
		for(int i = 0; i < 512; ++ i)
		{
			if(b.get(i))
			{
				System.out.print("1");
			}
			else
			{
				System.out.print("0");
			}
		}
	}
	
	private static byte[] getSHA512(String input)
	{
		MessageDigest sHAer = null;
		byte[] hash = null;
		try
		{
			sHAer = MessageDigest.getInstance("SHA-512");
		}
		catch (NoSuchAlgorithmException e1) { e1.printStackTrace(); }
		try
		{
			hash = sHAer.digest(input.getBytes("UTF-8"));
		}
		catch (UnsupportedEncodingException e) { e.printStackTrace(); }
		return hash;
	}
	
	private static BitSet getBits(byte[] bytes)
	{
		BitSet returnVal = BitSet.valueOf(bytes);
		
		return returnVal;
	}

	public static void main(String[] args)
	{
		PoetryBot pb = new PoetryBot();
		pb.run();
	}
}

@@ -267,54 +267,8 @@
 %0A%09%7B%0A
-%09%09Scanner listener = new Scanner(System.in);%0A%0A
 %09%09Sy
@@ -468,16 +468,61 @@
 ut? %22);%0A
+%09%09Scanner listener = new Scanner(System.in);%0A
 %09%09String
@@ -551,16 +551,36 @@
 Line();%0A
+%09%09listener.close();%0A
 %09%09System
@@ -722,73 +722,941 @@
 Set 
-foo = getBits(hash);%0A%09%09%0A%09%09printBitSet(foo)
+hashBits = getBits(hash);%0A%09%09printBitSet(hashBits);%0A%09%09%0A%09%09BitSet lineChooser = hashBits.get(0, 23);%0A%0A%09%09System.out.println(%22What would you like me to write about? %22);%0A%09%09printBitSet(lineChooser);%0A%09%09System.out.println(%22What would you like me to write about? %22);%0A%09%09%0A%09%09BitSet%5B%5D lines = getLines(lineChooser, hashBits);%0A%09%09%0A%09%09for(BitSet bs : lines)%0A%09%09%7B%0A%09%09%09printBitSet(bs);%0A%09%09%7D%0A%09%7D%0A%09%0A%09private static BitSet%5B%5D getLines(BitSet lineChooser, BitSet hashBits)%0A%09%7B%0A%09%09int numLines = 0;%0A%09%09%0A%09%09for(int lineBitIndex = 0; lineBitIndex %3C 22; ++ lineBitIndex)%0A%09%09%7B%0A%09%09%09if(lineChooser.get(lineBitIndex))%0A%09%09%09%7B%0A%09%09%09%09++ numLines
 ;%0A%09%09
+%09
+%7D
 %0A%09%09
-listener.close()
+%7D%0A%09%09%0A%09%09BitSet%5B%5D returnVal = new BitSet%5BnumLines%5D;%0A%09%09%0A%09%09int currentSpot = 0;%0A%09%09for(int lineBitIndex = 0; lineBitIndex %3C 22; ++ lineBitIndex)%0A%09%09%7B%0A%09%09%09if(lineChooser.get(lineBitIndex))%0A%09%09%09%7B%0A%09%09%09%09returnVal%5BcurrentSpot%5D = hashBits.get(lineBitIndex * 22, (lineBitIndex * 22) + 23);%0A%09%09%09%09%0A%09%09%09%09++ currentSpot;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return returnVal
 ;%0A%09%7D
@@ -1725,19 +1725,26 @@
  0; i %3C 
-512
+b.length()
 ; ++ i)%0A
@@ -1835,17 +1835,17 @@
 .print(%22
-0
+.
 %22);%0A%09%09%09%7D
@@ -1845,24 +1845,48 @@
 );%0A%09%09%09%7D%0A%09%09%7D%0A
+%09%09System.out.println();%0A
 %09%7D%0A%09%0A%09privat

Extracted important information