String originalInput = "test input"; String encodedString = Base64.getEncoder().encodeToString(originalInput.getBytes());