code: public boolean bucketExists(String bucketName)
      throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
             InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
             InternalException {
      try {
        executeHead(bucketName, null);
        return true;
      } catch (ErrorResponseException e) {
        if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_BUCKET) {
          throw e;
        }
      }
  
      return false;
    }
docs: Checks if given bucket exist and is having read access.
  
  </p><b>Example:</b><br>
  <pre>{@code boolean found = minioClient.bucketExists("my-bucketname");
  if (found) {
  System.out.println("my-bucketname exists");
  } else {
  System.out.println("my-bucketname does not exist");
  } }</pre>
  
  @param bucketName Bucket name.
  
  @return True if the bucket exists and the user has at least read access.
  
  @throws InvalidBucketNameException  upon invalid bucket name is given
  @throws NoSuchAlgorithmException
  upon requested algorithm was not found during signature calculation
  @throws InsufficientDataException   upon getting EOFException while reading given
  @throws IOException                 upon connection error
  @throws InvalidKeyException
  upon an invalid access key or secret key
  @throws NoResponseException         upon no response from server
  @throws XmlPullParserException      upon parsing response xml
  @throws ErrorResponseException      upon unsuccessful execution
  @throws InternalException           upon internal library error