private static char get(final CharSequence chars, final int i, final int length) {
		if (chars.length() < length) {
			final int d = length - i;
			return d <= chars.length() ? chars.charAt(chars.length() - d) : '0';
		} else if (chars.length() > length) {
			return chars.charAt(chars.length() - length  + i);
		} else {
			return chars.charAt(i);
		}
	}
Creates a new bit-array from the given string {@code value}. The given
{@code length} might be bigger and smaller than the length of the given
{@code value} string. The higher order bits of the created bit-array are
trimmed or filled with zero if the {@code length} is smaller or bigger
than the given string.

@see #of(CharSequence)
@see #toString()

@param value the given input string, consisting only of '0's and '1's
@param length the length of the created bit-array
@return a new bit-array from the given input {@code value}
@throws IllegalArgumentException if the given input {@code value} is
        empty
jenetics/src/main/java/io/jenetics/internal/collection/BitArray.java