Skip to content

Instantly share code, notes, and snippets.

@b8x
Last active April 21, 2023 12:29
Show Gist options
  • Save b8x/673e7f31b433a1baaaca9c954982ae3f to your computer and use it in GitHub Desktop.
Save b8x/673e7f31b433a1baaaca9c954982ae3f to your computer and use it in GitHub Desktop.
Base 64 Encoder Java
import java.util.Base64;
public class Base64Encoder {
public static void main(String[] args) {
String message = "Hello, world!";
// Encode the message
String encodedMessage = Base64.getEncoder().encodeToString(message.getBytes());
// Print the encoded message
System.out.println(encodedMessage);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment