Getting a list of all constructors of a class through reflection

Call getDeclaredConstructors on a Class object. There is another method called getConstructors but this one returns only public constructors.

import java.lang.reflect.*;
public class Main {
   public static void main(String args[]) throws Exception {
      Class c = Class.forName("MyClass");   // or Class c = MyClass.getClass();
      Constructor[] constructors = c.getDeclaredConstructors();
      for (int i=0; i<constructors.length; i++) {
class MyClass
   public MyClass() { }
   public MyClass(int a) { }
   protected MyClass(float f) { }
   private MyClass(String s) { }


public MyClass()
public MyClass(int)
protected MyClass(float)
private MyClass(java.lang.String)