Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String toDescName(String className) {
        int arrCount = className.lastIndexOf('[') + 1;
        if (arrCount > 0) {
            className = className.substring(arrCount);
        }
        if (className.length() == 1) {
            switch (className.charAt(0)) {
            case 'Z':
                className = "boolean";
                break;
            case 'B':
                className = "byte";
                break;
            case 'C':
                className = "char";
                break;
            case 'S':
                className = "short";
                break;
            case 'I':
                className = "int";
                break;
            case 'J':
                className = "long";
                break;
            case 'F':
                className = "float";
                break;
            case 'D':
                className = "double";
                break;
            }
        }
        for (int i = 0; i < arrCount; ++i) {
            className += "[]";
        }
        return className;
    }
}