code: private void findDistributions(int occur, Integer[] candidate, List<Integer[]> distributions, int level) {
          if (level != candidate.length) {
              for (int i = 0; i < 2; i++) {
                  candidate[level] = i;
  
                  int sum = 0;
                  for (int x = 0; x < candidate.length; x++)
                      sum += candidate[x];
  
                  if (sum == occur) {
                      distributions.add(candidate.clone());
                  } else {
                      findDistributions(occur, candidate, distributions, level + 1);
                  }
              }
          }
      }
docs: Finds valid distributions for a given R# group and it occurrence
  condition taken from the LOG line.<br>
  For example: if we have three Rn group atoms, and ">2" for
  the occurrence, then there are fours possible ways to make a
  distribution: 3 ways to put in two atoms, and one way
  to put in all 3 atoms. Etc.
  @param occur
  @param candidate
  @param distributions
  @param level