Package second; import java. util. arrayList; public class second {/*** Number of children multiple children in a game circle, number by number, and exit when the number is counted to a specified number, continue to the next number starting from 1, so that the return loop is used to find the last left child ** @ param args */public static void main (String [] args) {// TODO Auto-generated method stub // the specified number int num = 4; // the specified number of children int person [] = {1, 2, 3, 4, 5}; // starting from the first few children int beginperson = 1; // array subscript int count = beginperson-1 to be deleted; ArrayList <Integer> ai = new ArrayL Ist <Integer> (); for (int I = 0; I <person. length; I ++) {ai. add (person [I]);} int numperson = CounGameMethod (num, ai, beginperson, count); System. out. println ("+" + numperson + "");} private static int CounGameMethod (int num, ArrayList <Integer> person, int beginperson, int count) {if (person. size ()! = 1) {if (beginperson = num) {System. out. println ("th" + person. remove (count) + "children out"); if (count = person. size () {count = 0;} beginperson = 1;} else {beginperson ++; if (count <person. size ()-1) {count ++;} else {count = 0 ;}} return CounGameMethod (num, person, beginperson, count);} else {return person. get (0 );}}}