public class Solution { public static void main(String[] args) { int count = 0; int[] card = new int[4]; int sum = 0; while(true) { sum = 0; for(int i = 0; i < 4; i++) card[i] = (int)(Math.random() * 13 + 1); count++; for(int i: card) sum += i; if(sum == 24) break; } System.out.println("It has run " + count + " times"); } }