The first argument is actually not null; it is the empty string "" . The reason this is part of the output is because you split the empty string.
Split documentation says
The array returned by this method contains each substring of this string that ends with another substring that matches the given expression or ends at the end of the string.
Each position in your input line starts with an empty line (including position 0), so the split function also splits the input at position 0. Since there are no characters before position 0, this leads to an empty line for the first element.
Try this instead:
String sub = "0110000"; String a[] = sub.split("(?<=.)"); System.out.println(Arrays.toString(a));
Output:
[0, 1, 1, 0, 0, 0, 0]
The pattern (?<=.) Is a "positive zero-width lookbehind" that matches an arbitrary character ( . ). In words, he roughly "breaks into every empty line with some symbol in front of it."
source share