private static int availableProcessors() { Reflection.Method availableProcessors = Reflection.getInstance().getMethod("java.lang.Runtime.availableProcessors()"); if (availableProcessors != null) { Integer processors = (Integer) availableProcessors.invoke(Runtime.getRuntime()); return processors.intValue(); } else // J2ME. return 1; }