Java tutorial
//package com.java2s; //License from project: Apache License public class Main { /** * get method by sizer, it will return the first found method. */ public static String getSizerMethod(Class<?> cls, String[] sizer) { for (String s : sizer) { try { return cls.getMethod(s, new Class<?>[0]).getName() + "()"; } catch (NoSuchMethodException e) { } } return null; } }