Java tutorial
//package com.java2s; import android.graphics.Rect; import android.graphics.RectF; import java.util.Arrays; import java.util.LinkedHashMap; public class Main { private static int width; private static int height; private static LinkedHashMap<String, String> debugOutput = new LinkedHashMap<String, String>(); public static void log(String key, double value) { removeLog(key); debugOutput.put(key, value + ""); } public static void log(String key, String value) { removeLog(key); debugOutput.put(key, value); } public static void log(String key, Object value) { removeLog(key); debugOutput.put(key, value.toString()); } public static void log(String key, int[] ar) { debugOutput.put(key, Arrays.toString(ar)); } public static void log(String key, String[] ar) { debugOutput.put(key, Arrays.toString(ar)); } public static void log(String key, RectF rect) { debugOutput.put(key, rect.left + ", " + rect.top + ", " + rect.right + ", " + rect.bottom + " : " + rect.width() + ", " + rect.height()); } public static void log(String key, Rect rect) { debugOutput.put(key, rect.left + ", " + rect.top + ", " + rect.right + ", " + rect.bottom + " : " + rect.width() + ", " + rect.height()); } public static void removeLog(String key) { debugOutput.remove(key); } }