class Jps {

    static public List<Integer> getPid(String mainClassName) {
        if (mainClassName == null)
            return Collections.emptyList();

        String plainName = plainClassName(mainClassName);
        Jps jps = new Jps();
        List<Integer> ints = new LinkedList<Integer>();
        Set<Map.Entry<Integer, String>> set = jps.pidMap.entrySet();
        Iterator<Map.Entry<Integer, String>> it = set.iterator();

        while (it.hasNext()) {
            Map.Entry<Integer, String> entry = it.next();
            String valueFull = entry.getValue();
            String valuePlain = plainClassName(valueFull);

            if (mainClassName.equals(valueFull) || plainName.equals(valuePlain))
                // got a match!
                ints.add(entry.getKey());
        }
        return ints;
    }

    private  Jps();

}