Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: None  |  size: 0.43 KB  |  hits: 14  |  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. private HashMap<String, Integer> theIPs = new HashMap<String, Integer>();
  2.        
  3.         public void grabIPS() {
  4.                 String[] textLines = text1.getText().split("\n");
  5.                
  6.                 for (String textLine : textLines) {
  7.                         String s = textLine.substring(textLine.indexOf("IP ") + 3);
  8.                         s = s.substring(0, s.indexOf(" ")).trim();
  9.                        
  10.                         if (!theIPs.containsKey(s)) {
  11.                                 theIPs.put(s, 1);
  12.                         } else {
  13.                                 theIPs.put(s, theIPs.get(s) + 1);
  14.                         }
  15.                 }
  16.         }