code: public static String detectFormat(String strTime) {
          String format = null;
          if ((format = tryAndGetFormat(strTime, dateTimeWithSubSecAndTZFormat)) == null) {
              if ((format = tryAndGetFormat(strTime, dateTimeAndTZFormat)) == null) {
                  if ((format = tryAndGetFormat(strTime, dateTimeWithSubSecFormat)) == null) {
                      if ((format = tryAndGetFormat(strTime, dateTimeFormat)) == null) {
                          if ((format = tryAndGetFormat(strTime, dateHourMinOnlyFormat)) == null) {
                              if ((format = tryAndGetFormat(strTime, dateHourOnlyFormat)) == null) {
                                  if ((format = tryAndGetFormat(strTime, dateTimeWithSubSecAndTZWithSpaceFormat)) == null) {
                                      if ((format = tryAndGetFormat(strTime, dateTimeAndTZWithSpaceFormat)) == null) {
                                          if ((format = tryAndGetFormat(strTime, dateTimeWithSubSecWithSpaceFormat)) == null) {
                                              if ((format = tryAndGetFormat(strTime, dateTimeWithSpaceFormat)) == null) {
                                                  if ((format = tryAndGetFormat(strTime, dateHourMinWithSpaceOnlyFormat)) == null) {
                                                      if ((format = tryAndGetFormat(strTime, dateHourWithSpaceOnlyFormat)) == null) {
                                                          if ((format = tryAndGetFormat(strTime, dateOnlyFormat)) == null) {
                                                              if ((format = tryAndGetFormat(strTime, yearMonthOnlyFormat)) == null) {
                                                                  if ((format = tryAndGetFormat(strTime, yearOnlyFormat)) == null) {
                                                                      return format;
                                                                  }
                                                              }
                                                          }
                                                      }
                                                  }
                                              }
                                          }
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
          return format;
      }
docs: TODO: Horrific levels of nesting, do something about this.