get Default Thread Pool Size - Android java.lang

Android examples for java.lang:Thread

Description

get Default Thread Pool Size

Demo Code

public class Main {

  public static int getDefaultThreadPoolSize(int max) {
    int availableProcessors = 2 * Runtime.getRuntime().availableProcessors() + 1;
    return availableProcessors > max ? max : availableProcessors;
  }//from ww w. j a  va2 s . c  om

}

Related Tutorials