Here you can find the source of dumpThreads(PrintStream ps)
public static void dumpThreads(PrintStream ps)
//package com.java2s; /*/* w w w . ja va 2 s . c o m*/ * $URL$ * $Revision$ * $Author$ * $Date$ * * $Copyright-Start$ * * Copyright (c) 2016 * Sam Corporation * All Rights Reserved * * This software is furnished under a corporate license for use on a * single computer system and can be copied (with inclusion of the * above copyright) only for use on such a system. * * The information in this document is subject to change without notice * and should not be construed as a commitment by Sam Corporation. * * Sam Corporation assumes no responsibility for the use of the * software described in this document on equipment which has not been * supplied or approved by Sam Corporation. * * $Copyright-End$ */ import java.io.PrintStream; public class Main { public static void dumpThreads(PrintStream ps) { int active = Thread.activeCount(); Thread threads[] = new Thread[active]; Thread.enumerate(threads); for (int i = 0; i < active; i++) { ps.println(i + ": " + threads[i]); } } }