src/main/java/com/cedarsoftware/util/io/MetaUtils.java
static Object[] tryOtherConstruction(Class c)
    {
        Constructor[] constructors = c.getDeclaredConstructors();
        if (constructors.length == 0)
        {
            throw new JsonIoException("Cannot instantiate '" + c.getName() + "' - Primitive, interface, array[] or void");
        }

        // Sort constructors - public, protected, private, package-private
        List<Constructor> constructorList = Arrays.asList(constructors);
        Collections.sort(constructorList, new Comparator<Constructor>()
        {
            public int compare(Constructor c1, Constructor c2)
            {
                int c1Vis = c1.getModifiers();
                int c2Vis = c2.getModifiers();

                if (c1Vis == c2Vis)
                {   // both are public, protected, private, etc.  Compare by arguments.
                    return compareConstructors(c1, c2);
                }

                if (isPublic(c1Vis) != isPublic(c2Vis))
                {   // favor 'public' as first
                    return isPublic(c1Vis) ? -1 : 1;
                }

                if (isProtected(c1Vis) != isProtected(c2Vis))
                {   // favor protected 2nd
                    return isProtected(c1Vis) ? -1 : 1;
                }

                if (isPrivate(c1Vis) != isPrivate(c2Vis))
                {   // favor private last
                    return isPrivate(c1Vis) ? 1 : -1;
                }

                return 0;
            }
        });

        // Try each constructor (public, protected, private, package-private) with null values for non-primitives.
        for (Constructor constructor : constructorList)
        {
            constructor.setAccessible(true);
            Class[] argTypes = constructor.getParameterTypes();
            Object[] values = fillArgs(argTypes, true);
            try
            {
                return new Object[] {constructor.newInstance(values), constructor, true};
            }
            catch (Exception ignored)
            { }
        }

        // Try each constructor (public, protected, private, package-private) with non-null values for non-primitives.
        for (Constructor constructor : constructorList)
        {
            constructor.setAccessible(true);
            Class[] argTypes = constructor.getParameterTypes();
            Object[] values = fillArgs(argTypes, false);
            try
            {
                return new Object[] {constructor.newInstance(values), constructor, false};
            }
            catch (Exception ignored)
            { }
        }

        // Try instantiation via unsafe
        // This may result in heapdumps for e.g. ConcurrentHashMap or can cause problems when the class is not initialized
        // Thats why we try ordinary constructors first
        if (useUnsafe)
        {
            try
            {
                return new Object[]{unsafe.allocateInstance(c), null, null};
            }
            catch (Exception ignored)
            { }
        }

        throw new JsonIoException("Could not instantiate " + c.getName() + " using any constructor");
    }
static Object[] tryOtherConstruction(Class c)
    {
        Constructor[] constructors = c.getDeclaredConstructors();
        if (constructors.length == 0)
        {
            throw new JsonIoException("Cannot instantiate '" + c.getName() + "' - Primitive, interface, array[] or void");
        }

        // Sort constructors - public, protected, private, package-private
        List<Constructor> constructorList = Arrays.asList(constructors);
        Collections.sort(constructorList, new Comparator<Constructor>()
        {
            public int compare(Constructor c1, Constructor c2)
            {
                int c1Vis = c1.getModifiers();
                int c2Vis = c2.getModifiers();

                if (c1Vis == c2Vis)
                {   // both are public, protected, private, etc.  Compare by arguments.
                    return compareConstructors(c1, c2);
                }

                if (isPublic(c1Vis) != isPublic(c2Vis))
                {   // favor 'public' as first
                    return isPublic(c1Vis) ? -1 : 1;
                }

                if (isProtected(c1Vis) != isProtected(c2Vis))
                {   // favor protected 2nd
                    return isProtected(c1Vis) ? -1 : 1;
                }

                if (isPrivate(c1Vis) != isPrivate(c2Vis))
                {   // favor private last
                    return isPrivate(c1Vis) ? 1 : -1;
                }

                return 0;
            }
        });

        // Try each constructor (public, protected, private, package-private) with null values for non-primitives.
        for (Constructor constructor : constructorList)
        {
            constructor.setAccessible(true);
            Class[] argTypes = constructor.getParameterTypes();
            Object[] values = fillArgs(argTypes, true);
            try
            {
                return new Object[] {constructor.newInstance(values), constructor, true};
            }
            catch (Exception ignored)
            { }
        }

        // Try each constructor (public, protected, private, package-private) with non-null values for non-primitives.
        for (Constructor constructor : constructorList)
        {
            constructor.setAccessible(true);
            Class[] argTypes = constructor.getParameterTypes();
            Object[] values = fillArgs(argTypes, false);
            try
            {
                return new Object[] {constructor.newInstance(values), constructor, false};
            }
            catch (Exception ignored)
            { }
        }

        // Try instantiation via unsafe
        // This may result in heapdumps for e.g. ConcurrentHashMap or can cause problems when the class is not initialized
        // Thats why we try ordinary constructors first
        if (useUnsafe)
        {
            try
            {
                return new Object[]{unsafe.allocateInstance(c), null, null};
            }
            catch (Exception ignored)
            { }
        }

        throw new JsonIoException("Could not instantiate " + c.getName() + " using any constructor");
    }
Brute force attempt to locate a constructor to construct the passed in Class.  This involves trying all
constructors, public, protected, package-private, and private.  It will try with null arguments as well
as it will make a 2nd attempt with populated values for some known types (Collection classes, Dates, Strings,
primitive wrappers, TimeZone, Calendar).
@param c Class to instantiate
@return an Object[] containing three (3) elements.  Position 0 is the instance of the class, position 1
is the constructor used, and position 2 indicates whether fillArgs was called with useNull or !useNull.