Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.util.Base64;

public class Main {
    static public String decodeToSgtring(String code) {
        if (code == null || code.length() == 0) {
            return "";
        }
        try {
            return new String(Base64.decode(code.getBytes(), Base64.NO_WRAP));
        } catch (Exception e) {
            e.printStackTrace();
            return code;
        }

    }

    static public String decodeToSgtring(byte[] code) {
        if (code == null || code.length == 0) {
            return "";
        }
        return new String(Base64.decode(code, Base64.NO_WRAP));
    }
}