Java tutorial
//package com.java2s; import java.util.*; public class Main { public static int getKeyMaxSize(Map<String, ?> map) { int maxLength = 0; for (String key : map.keySet()) { if (key != null && key.length() > maxLength) { maxLength = key.length(); } } return maxLength; } }