/** * Converts 2:1-34 to Location 2 Slot 1 set Ammo to 34 */ public void addSetAmmoTo(String s) { int ewSpot = s.indexOf(':'); int amSpot = s.indexOf('-'); if(s.isEmpty() || (ewSpot < 1) || (amSpot < ewSpot)) { return; } int loc = Integer.parseInt(s.substring(0, ewSpot)); int slot = Integer.parseInt(s.substring(ewSpot + 1, amSpot)); int setTo = Integer.parseInt(s.substring(amSpot + 1)); ammoSetTo.add(new SetAmmoTo(loc, slot - 1, setTo)); }