Java tutorial
//package com.java2s; import java.util.HashMap; public class Main { public static HashMap<String, String> getEANHashMap(String[] eans) { HashMap<String, String> ret = new HashMap<String, String>(); for (int i = 0; i < eans.length; i++) { ret.put(eans[i], Integer.toString(i + 1)); } return ret; } }