Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 31st, 2012  |  syntax: Java  |  size: 0.81 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public void selectMethod()
  2. {
  3.         HashMap <String,ArrayList> memberMap = new HashMap<String,ArrayList>();
  4.         HashMap.put("Method",new ArrayList<Method>());
  5.         Method[] c = Vector.class.getMethods();
  6.         mMask = setBitMasks("110100111111);
  7.         for (Method m : c.getMethods())
  8.         {
  9.          BitSet mMod = mod;//the mod to match
  10.                BitSet sMod = setBitMasks(Integer.toBinaryString(m.getModifiers()));
  11.                mMod.and(mMask);
  12.                    
  13.                 if (mMod.equals(sMod))
  14.                 {
  15.                        memberMap.get("Method").add(m);
  16.                 }
  17.         }      
  18. }
  19.  
  20. public BitMask setBitMasks(String binaryString)
  21. {
  22.          BitSet bMask = new BitSet(bits.length());
  23.                 for (int i = 0; i < bits.length(); i++) {
  24.                     if (bits.charAt(i) == '1') {
  25.                           bMask.set(i);
  26.                    }
  27.               }
  28.        return bMask;
  29. }