import java.util.HashMap;
public class nested {
public static void main(String args[]) {
HashMap<String, HashMap<String, String>> map = new HashMap<String, HashMap<String,String>>();
map.put("ftp1", new HashMap<String, String>());
map.put("ftp2", new HashMap<String, String>());
map.put("ftp3", new HashMap<String, String>());
map.put("ftp4", new HashMap<String, String>());
map.get("ftp1").put("account", "ibm");
map.get("ftp1").put("ip", "10.0.0.1");
map.get("ftp1").put("password", "letmein");
map.get("ftp1").put("dir", "C:tester");
map.get("ftp1").put("direction", "send");
map.get("ftp2").put("account", "microsoft");
map.get("ftp2").put("ip", "10.0.0.2");
map.get("ftp2").put("password", "letmein");
map.get("ftp2").put("dir", "C:tester");
map.get("ftp2").put("direction", "receive");
map.get("ftp3").put("account", "oracle");
map.get("ftp3").put("ip", "10.0.0.6");
map.get("ftp3").put("password", "letmein");
map.get("ftp3").put("dir", "C:tester");
map.get("ftp3").put("direction", "both");
map.get("ftp4").put("account", "java");
map.get("ftp4").put("ip", "10.0.0.9");
map.get("ftp4").put("password", "letmein");
map.get("ftp4").put("dir", "C:tester");
map.get("ftp4").put("direction", "receive");
int sizeOfMap=map.size();
for(int counter=0; counter<=sizeOfMap; counter++)
if(map.containsKey("ftp"+counter)){
String valueFromMap = map.get("ftp"+counter).get("account");
System.out.println("Account :"+valueFromMap);
valueFromMap = map.get("ftp"+counter).get("ip");
System.out.println("IP :"+valueFromMap);
valueFromMap = map.get("ftp"+counter).get("password");
System.out.println("Password :"+valueFromMap);
valueFromMap = map.get("ftp"+counter).get("dir");
System.out.println("Directory :"+valueFromMap);
valueFromMap = map.get("ftp"+counter).get("direction");
System.out.println("Direction :"+valueFromMap);
System.out.println("");