import java.util.*;
public class AdditionDemo
{
public static void main(String[] args)
{
HashMap hm=new HashMap();
int arr[]=new int[9];
for(int i=0;i<9;i++)
arr[i]=i+1;
for (int i:arr)
{
if(hm.get(i)==null)
{
if(hm.get(10-i)!=null)
hm.put((10-i),i);
else
hm.put(i,0);
}
}
System.out.println(hm);
}
}
No comments:
Post a Comment