Convert a object or primitive name into androguard syntax

    For example:
        byte --> B
        foo.bar.bla --> Lfoo/bar/bla;
        [int --> [I

    There is also a special case, where some arrays are specified differently:
        B[] --> [B
        foo.bar.bla[] --> [Lfoo/bar/bla;

    :param n:
    :return:

def name_to_androguard(n):
    """
    Convert a object or primitive name into androguard syntax

    For example:
        byte --> B
        foo.bar.bla --> Lfoo/bar/bla;
        [int --> [I

    There is also a special case, where some arrays are specified differently:
        B[] --> [B
        foo.bar.bla[] --> [Lfoo/bar/bla;

    :param n:
    :return:
    """
    if n == "":
        return ""
    is_array = ""
    # FIXME what about n-dimensional arrays?
    if n.startswith("["):
        is_array = "["
        n = n[1:]
    elif n.endswith("[]"):
        # Another special array type...
        # Probably a bug? See
        if n[:-2] in TYPE_DESCRIPTOR:
            return "[{}".format(n[0])
        else:
            n = n[:-2]
            is_array = "["
    if n in R_TYPE_DESCRIPTOR:
        return "{}{}".format(is_array, R_TYPE_DESCRIPTOR[n])
    else:
        # assume class
        return "{}L{};".format(is_array, n.replace(".", "/"))