Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Copyright (C) 2011 The LiteListen Project
 * 
 * Licensed under the Mozilla Public Licence, version 1.1 (the "License");
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 *   2011
 *  Mozilla Public Licence 1.1 
 * 
 * 
 *
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 */

public class Main {
    public static String UnicodeToString(String Hex) {
        String enUnicode = null;
        String deUnicode = null;

        for (int i = 0; i < Hex.length(); i++) {
            if (enUnicode == null)
                enUnicode = String.valueOf(Hex.charAt(i));
            else
                enUnicode = enUnicode + Hex.charAt(i);

            if (i % 4 == 3) {
                if (enUnicode != null) {
                    if (deUnicode == null)
                        deUnicode = String.valueOf((char) Integer.valueOf(enUnicode, 16).intValue());
                    else
                        deUnicode = deUnicode + String.valueOf((char) Integer.valueOf(enUnicode, 16).intValue());
                }

                enUnicode = null;
            }
        }

        return deUnicode;
    }
}