tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Jodd > Commons > How to encode and decode in Base32

How to encode and decode in Base32 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use Base32.encode() and Base32.decode() APIs.

File Name  :  
com/bethecoder/tutorials/jodd/encode/Base32Test.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.jodd.encode;

import jodd.util.Base32;

public class Base32Test {

  /**
   @param args
   */
  public static void main(String[] args) {

    String str = "BE THE CODER";
    
    String encoded = Base32.encode(str.getBytes());
    System.out.println(encoded);
    
    byte [] decoded = Base32.decode(encoded);
    System.out.println(new String(decoded));
    
    
    str = "My test message";
    
    encoded = Base32.encode(str.getBytes());
    System.out.println(encoded);
    
    decoded = Base32.decode(encoded);
    System.out.println(new String(decoded));
  }

}
   

It gives the following output,
IJCSAVCIIUQEGT2EIVJA
BE THE CODER

JV4SA5DFON2CA3LFONZWCZ3F
My test message



 
  


  
bl  br