private static int getBytesPerPixel(Bitmap.Config config) {
    switch (config) {
      case ARGB_8888:
        return 4;
      case RGB_565:
      case ARGB_4444:
        return 2;
    }
    return 1;
  }
Implementation of LRU cache (String to Bitmap) with a method to grab the oldest Bitmap.
tileview/src/main/java/com/moagrius/tileview/MemoryCache.java