code: public static SegwitAddress fromKey(NetworkParameters params, ECKey key) {
          checkArgument(key.isCompressed(), "only compressed keys allowed");
          return fromHash(params, key.getPubKeyHash());
      }
docs: Construct a {@link SegwitAddress} that represents the public part of the given {@link ECKey}. Note that an
  address is derived from a hash of the public key and is not the public key itself.
  
  @param params
  network this address is valid for
  @param key
  only the public part is used
  @return constructed address