Oh, and there's a new, more efficient method for calculating the number of bytes that a string takes up when encoded in a given charset (https://bugs.openjdk.org/browse/JDK-8375318)