Here you can find the source of arrayToMap(int[] array)
public static HashMap<Integer, Integer> arrayToMap(int[] array)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static HashMap<Integer, Integer> arrayToMap(int[] array) { HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); for (int i = 0; i < array.length; i++) { map.put(i + 1, array[i]);/*www .j a v a 2s.c om*/ } return map; } public static HashMap<Integer, Object> arrayToMap(Object[] array) { HashMap<Integer, Object> map = new HashMap<Integer, Object>(); for (int i = 0; i < array.length; i++) { map.put(i + 1, array[i]); } return map; } }