Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> namesOfActiveThreadsIn(ThreadGroup grp) { List<String> threadNames = new ArrayList<String>(); Thread[] threads = new Thread[grp.activeCount() * 10]; int count = grp.enumerate(threads); for (int i = 0; i < count; i++) { threadNames.add(threads[i].getName()); } return threadNames; } }