/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String bitstream
= "001010100010010101001010101001010101010010101010100010101010001010101010010101"; int len = 8;
System.
out.
println(java.
util.
Arrays.
toString(splitAfterNChars
(bitstream, len
))); }
public static String[] splitAfterNChars
(String input,
int splitLen
){ return input.
split(String.
format("(?<=\\G.{%1$d})", splitLen
)); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN0cmluZyBiaXRzdHJlYW0gPSAiMDAxMDEwMTAwMDEwMDEwMTAxMDAxMDEwMTAxMDAxMDEwMTAxMDEwMDEwMTAxMDEwMTAwMDEwMTAxMDEwMDAxMDEwMTAxMDEwMDEwMTAxIjsKCQlpbnQgbGVuID0gODsKCQlTeXN0ZW0ub3V0LnByaW50bG4oamF2YS51dGlsLkFycmF5cy50b1N0cmluZyhzcGxpdEFmdGVyTkNoYXJzKGJpdHN0cmVhbSwgbGVuKSkpOwoJfQoJCglwdWJsaWMgc3RhdGljIFN0cmluZ1tdIHNwbGl0QWZ0ZXJOQ2hhcnMoU3RyaW5nIGlucHV0LCBpbnQgc3BsaXRMZW4pewoJCXJldHVybiBpbnB1dC5zcGxpdChTdHJpbmcuZm9ybWF0KCIoPzw9XFxHLnslMSRkfSkiLCBzcGxpdExlbikpOwoJfQp9
[00101010, 00100101, 01001010, 10100101, 01010100, 10101010, 10001010, 10100010, 10101010, 010101]