public class myclass
{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int array1[] = new int[4];
System.out.println("Enter some integers");
for(int i = 0; i <array1.length; i++){
array1[i] = scan.nextInt();
}
Arrays.sort(array1);
HashMap<String, Integer> map = new HashMap<>();
map.put("IdOne", array1[0]);
map.put("IdOne", array1[1]);
map.put("IdOne", array1[2]);
}
}
I want to be able to print the values that I entered into the array along with a key from the Hashmap. Example output:
Enter some integers
3
5
2
IdOne 2
IdOne 3
IdOne 5