public Map<State,Double> threadStatePercentages(){
  final Map<State,Double> conditions=new HashMap<State,Double>();
  for (  State state : State.values()) {
    conditions.put(state,0.0);
  }
  final long[] allThreadIds=threads.getAllThreadIds();
  final ThreadInfo[] allThreads=threads.getThreadInfo(allThreadIds);
  int liveCount=0;
  for (  ThreadInfo info : allThreads) {
    if (info != null) {
      final State state=info.getThreadState();
      conditions.put(state,conditions.get(state) + 1);
      liveCount++;
    }
  }
  for (  State state : new ArrayList<State>(conditions.keySet())) {
    conditions.put(state,conditions.get(state) / liveCount);
  }
  return Collections.unmodifiableMap(conditions);
}

public Map < State , Double > threadStatePercentages ( ) { final Map < State , Double > conditions = new HashMap < State , Double > ( ) ; for ( State state : State . values ( ) ) { conditions . put ( state , 0.0 ) ; } final long [ ] allThreadIds = threads . getAllThreadIds ( ) ; final ThreadInfo [ ] allThreads = threads . getThreadInfo ( allThreadIds ) ; int liveCount = 0 ; for ( ThreadInfo info : allThreads ) { if ( info != null ) { final State state = info . getThreadState ( ) ; conditions . put ( state , conditions . get ( state ) + 1 ) ; liveCount ++ ; } } for ( State state : new ArrayList < State > ( conditions . keySet ( ) ) ) { conditions . put ( state , conditions . get ( state ) / liveCount ) ; } return Collections . unmodifiableMap ( conditions ) ; }
returns a map of thread states to the percentage of all threads which are in that state .
