Critical current in Josephson junction arrays