public Waiter<HeadBucketRequest> bucketExists() {

        return new WaiterBuilder<HeadBucketRequest, HeadBucketResult>()
            .withSdkFunction(new HeadBucketFunction(client))
            .withAcceptors(
                new HttpSuccessStatusAcceptor<HeadBucketResult>(WaiterState.SUCCESS),
                new HttpFailureStatusAcceptor<HeadBucketResult>(301, WaiterState.SUCCESS),
                new HttpFailureStatusAcceptor<HeadBucketResult>(403, WaiterState.SUCCESS),
                new HttpFailureStatusAcceptor<HeadBucketResult>(404, WaiterState.RETRY))
            .withDefaultPollingStrategy(
                new PollingStrategy(new MaxAttemptsRetryStrategy(20),
                                    new FixedDelayStrategy(5)))
            .withExecutorService(executorService).build();
    }
Builds a BucketExists waiter by using custom parameters waiterParameters
and other parameters defined in the waiters specification, and then polls
until it determines whether the resource entered the desired state or
not, where polling criteria is bound by either default polling strategy
or custom polling strategy.
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/waiters/AmazonS3Waiters.java