Guest User

Untitled

a guest
Apr 10th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import org.apache.commons.codec.binary.Base64;
  2.  
  3. public class Base64Demo {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. String userName = "eoeAndroid";
  8. String password = "this is password";
  9. String authCombination = userName + ":" + password;
  10. String authBase64 = new String(Base64.encodeBase64(authCombination.getBytes()));
  11. System.out.println("authCombination = "+authCombination);
  12. System.out.println("authBase64 = "+authBase64);
  13. String authRecovery = new String(Base64.decodeBase64(authBase64.getBytes()));
  14. System.out.println("authRecovery = "+authRecovery);
  15. }
  16.  
  17. }
Add Comment
Please, Sign In to add comment