Encrypt string using One Time Pad
Security. xor is an associative operation.

    nth ^= pieces[0];
    nth ^= pieces[1];
    ...
    nth ^= pieces[n-2]


like your code does is as good as

    nth ^= (pieces[0] ^ pieces[1] ^ ... ^ pieces[n-2]

doXOR is way too verbose to my taste.
toBinary doesn't belong here (and is never called indeed, unless I am missing something).
Obviously all the keys you have generated collapse into a single one. The bad guy doesn't have to recover all the keys - he only needs their accumulated xor. There is no additional security.