code: public static DbxThumbnailFormat bestForFileName(String fileName, DbxThumbnailFormat fallback)
      {
          fileName = fileName.toLowerCase();
          if (fileName.endsWith(".png") || fileName.endsWith(".gif")) {
              return DbxThumbnailFormat.PNG;
          }
          else if (fileName.endsWith(".jpeg") || fileName.endsWith(".jpg") || fileName.endsWith(".jpe")) {
              return DbxThumbnailFormat.JPEG;
          }
          return fallback;
      }
docs: Try and guess the right {@code DbxThumbnailFormat} to use based on the image's file
  name.  Sometimes this function won't be able to guess and will just return whatever you
  pass in for {@code fallback}.
  
  <pre>
  DbxThumbnailFormat.bestForFileName("test.png");          // returns DbxThumbnailFormat.PNG
  DbxThumbnailFormat.bestForFileName("/stuff/funny.GIF");  // returns DbxThumbnailFormat.PNG
  DbxThumbnailFormat.bestForFileName("/family.jpg");       // returns DbxThumbnailFormat.JPEG
  </pre>