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