class ModisUtils {

    public static String extractValueForKey(String metaDataString, String key) {
        Guardian.assertNotNull("metaDataString", metaDataString);
        Guardian.assertNotNull("key", key);

        int pos = metaDataString.indexOf(key);
        if (pos >= 0) {
            pos = metaDataString.indexOf("VALUE", pos);
            if (pos >= 0) {
                pos = metaDataString.indexOf('=', pos);
                if (pos >= 0) {
                    int endPos = metaDataString.indexOf('\n', pos + 1);
                    if (endPos >= 0) {
                        String value = metaDataString.substring(pos + 1, endPos);
                        value = value.replace('"', ' ');
                        return value.trim();
                    }
                }
            }
        }
        return null;
    }

}