code: private <T> T parseVersion(DataInputStream input, Class<T> declaredType) throws Exception {
          // root array
          int arrayByte = input.readByte();
          int versionByte = input.readByte();
          switch (versionByte) {
              case 1:
                  if (arrayByte != MIN_FIX_ARRAY + 2) {
                      throw new IllegalArgumentException(
                              "Invalid binary data: Expected array with 2 elements, but was: 0x" + toHex(arrayByte));
                  }
                  return new JodaBeanStandardBinReader(settings, input).read(declaredType);
              case 2:
                  if (arrayByte != MIN_FIX_ARRAY + 4) {
                      throw new IllegalArgumentException(
                              "Invalid binary data: Expected array with 4 elements, but was: 0x" + toHex(arrayByte));
                  }
                  return new JodaBeanReferencingBinReader(settings, input).read(declaredType);
              default:
                  throw new IllegalArgumentException(
                          "Invalid binary data: Expected version 1 or 2, but was: 0x" + toHex(versionByte));
          }
      }
docs: parses the version