I've got a really long String of bits,
And I want to chop it into pieces of eight and make
bytes out of them, in an array.
what would be a performant way to do this?
Unless you have truely gigantic strings arriving a high rate per second then performance is unlikely to be an issue. Much better to find a clear and obvious way to code it, and only worry about performance if it becomes a problem.
Just convert to a char array, then take each char in each block of 8 one at a time and set the corresponding bit of the output byte.