public static Builder newBuilder(KeysetHandle handle) {
    Builder builder = new Builder();
    for (int i = 0; i < handle.size(); ++i) {
      // Currently, this can be null (as old APIs do not check validity e.g. in {@link #fromKeyset})
      @Nullable KeysetHandle.Entry entry = handle.entries.get(i);
      if (entry == null) {
        builder.setErrorToThrow(
            new GeneralSecurityException(
                "Keyset-Entry in original keyset at position "
                    + i
                    + " has wrong status or key parsing failed"));
        break;
      }

      KeysetHandle.Builder.Entry builderEntry =
          importKey(entry.getKey()).withFixedId(entry.getId());
      builderEntry.setStatus(entry.getStatus());
      if (entry.isPrimary()) {
        builderEntry.makePrimary();
      }
      builder.addEntry(builderEntry);
    }
    return builder;
  }
Creates a new builder, initially containing all entries from {@code handle}.
java_src/src/main/java/com/google/crypto/tink/KeysetHandle.java