Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import com.google.common.collect.BiMap;

public class Main {
    private static BiMap<String, String> smaliPrimitiveToJavaWrapper;

    public static String smaliPrimitiveToJavaWrapper(String className) {
        String javaWrapper = smaliPrimitiveToJavaWrapper.get(getBaseClass(className));
        if (null == javaWrapper) {
            return null;
        }

        if (!className.startsWith("[")) {
            return javaWrapper;
        }

        int lastIndex = className.lastIndexOf('[');
        String dimens = className.substring(0, lastIndex + 1);
        StringBuilder sb = new StringBuilder(dimens);
        sb.append('L').append(javaWrapper).append(';');

        return sb.toString();
    }

    public static String getBaseClass(String className) {
        // Remove any array qualifiers, e.g. [[B (2d byte array) becomes B
        return className.replace("[", "");
    }
}