tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Ostermiller Utilities > Base64 Decode Byte Array

Base64 Decode Byte Array 

Ostermiller Java Utilities contain various components such as CSV parsing, Base64 Encoding, MD5 digest, String and Exec Helper classes. This requires the library ostermillerutils-1.08.01.jar to be in classpath. The following example shows decoding a Base64 encoded String to byte array.

File Name  :  
com/bethecoder/tutorials/ostermillerutils/Base64DecodeByteArrayTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.ostermillerutils;

import java.nio.ByteBuffer;

import com.Ostermiller.util.Base64;

public class Base64DecodeByteArrayTest {

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

    //"17291729 as byte array" encoded in Base64
    String strToDecode = "AQfZ0Q==";
    byte [] bytes = Base64.decodeToBytes(strToDecode);
    System.out.println(ByteBuffer.wrap(bytes).getInt());
  }

}
   

It gives the following output,
17291729



 
  


  
bl  br