We would like to know how to store String to int array map in HashMap.
import java.util.HashMap; //from w ww.j a va2s .c o m public class Main { public static void main(String[] args) { HashMap<String, int[]> h = new HashMap<String, int[]>(); h.put("PID", new int[] { 1, 2 }); System.out.println(h.get("PID")[0]); System.out.println(h.get("PID")[1]); } }
The code above generates the following result.