I do not know any API method, but the conversion is quite simple. You can find the details in the JVM spec here . Primitive types are represented by a single character:
B = byte
C = char
D = double
F = float
I = int
J = long
S = short
Z = boolean
The types of classes and interfaces are represented by the full name, with the Prefix 'L' and ''; suffix. Points. in the name of a fully qualified class is replaced by "/" (for inner classes ".", which separates the name of the outer class from the inner class name, is replaced by "$"). Thus, the internal name of the String class will be "Ljava / lang / String;" and the inner name of the inner class "java.awt.geom.Arc2D.Float" will be "Ljava / awt / geom / Arc2D $ Float;".
Array names begin with an opening parenthesis '[', followed by the name of the component type (primitive or reference). Thus, "int []" becomes "[I" and "javax.swing.JFrame [] []" becomes "[[Ljavax.swing.JFrame;".
source share