code: private static void validateTypes(byte[] types) {
          if (types == null) {
              throw new IllegalArgumentException("types is null");
          }
          for (int i = 0; i < types.length; ++i) {
              if (types[i] < TYPE_MIN || types[i] > TYPE_MAX) {
                  throw new IllegalArgumentException("illegal type value at " + i + ": " + types[i]);
              }
          }
          for (int i = 0; i < types.length - 1; ++i) {
              if (types[i] == B) {
                  throw new IllegalArgumentException("B type before end of paragraph at index: " + i);
              }
          }
      }
docs: Throw exception if type array is invalid.