Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * DCL2 Adjust the name of the class to make the identification easier It is
     * done by converting all "/" to "."
     * 
     * Still "converts" the primitive types to your Wrapper.
     * 
     * @param className
     *            Name of the class
     * @return Adjusted class name
     */
    public static String adjustClassName(String className) {
        if (className.startsWith("boolean") || className.startsWith("byte") || className.startsWith("short")
                || className.startsWith("long") || className.startsWith("double")
                || className.startsWith("float")) {
            return "java.lang." + className.toUpperCase().substring(0, 1) + className.substring(1);
        } else if (className.startsWith("int")) {
            return "java.lang.Integer";
        } else if (className.startsWith("int[]")) {
            return "java.lang.Integer[]";
        } else if (className.startsWith("char")) {
            return "java.lang.Character";
        } else if (className.startsWith("char[]")) {
            return "java.lang.Character[]";
        }
        return className.replaceAll("/", ".");
    }
}