when I am trying to compare values of character(keys) using string in a Hashmap
for(int i = 0 ; i < s.length()-1 ; i++){
if(map.get(s.charAt(i)) <= map.get(s.charAt(i+1))){
sum = sum+map.get(s.charAt(i));
}
else{
sum = sum + map.get(s.charAt(i+1)) - map.get(s.charAt(i));
}
}
can anybody help me out?