code: protected int[] getFringeIndexes (int bits)
      {
          int index = BITS_TO_INDEX[bits];
          if (index != -1) {
              int[] ret = new int[1];
              ret[0] = index;
              return ret;
          }
  
          // otherwise, split the bits into contiguous components
  
          // look for a zero and start our first split
          int start = 0;
          while ((((1 << start) & bits) != 0) && (start < NUM_FRINGEBITS)) {
              start++;
          }
  
          if (start == NUM_FRINGEBITS) {
              // we never found an empty fringebit, and since index (above)
              // was already -1, we have no fringe tile for these bits.. sad.
              return new int[0];
          }
  
          ArrayList<Integer> indexes = Lists.newArrayList();
          int weebits = 0;
          for (int ii = (start + 1) % NUM_FRINGEBITS; ii != start; ii = (ii + 1) % NUM_FRINGEBITS) {
  
              if (((1 << ii) & bits) != 0) {
                  weebits |= (1 << ii);
              } else if (weebits != 0) {
                  index = BITS_TO_INDEX[weebits];
                  if (index != -1) {
                      indexes.add(index);
                  }
                  weebits = 0;
              }
          }
          if (weebits != 0) {
              index = BITS_TO_INDEX[weebits];
              if (index != -1) {
                  indexes.add(index);
              }
          }
  
          int[] ret = new int[indexes.size()];
          for (int ii = 0; ii < ret.length; ii++) {
              ret[ii] = indexes.get(ii);
          }
          return ret;
      }
docs: Get the fringe index specified by the fringebits. If no index is available, try breaking
  down the bits into contiguous regions of bits and look for indexes for those.