code: private static boolean available(final int element, final int charge, final int valence) {
  
          // higher atomic number elements aren't likely to be found but
          // we have them for rare corner cases (tellurium).
          // Germanium, Silicon, Tin and Antimony are a bit bonkers...
          switch (Elements.ofNumber(element)) {
              case Boron:
                  if (charge == 0 && valence <= 2) return true;
                  if (charge == -1 && valence <= 3) return true;
                  break;
              case Carbon:
              case Silicon:
              case Germanium:
              case Tin:
                  if (charge == 0 && valence <= 3) return true;
                  break;
              case Nitrogen:
              case Phosphorus:
              case Arsenic:
              case Antimony:
                  if (charge == 0) return valence <= 2 || valence == 4;
                  if (charge == 1) return valence <= 3;
                  break;
              case Oxygen:
              case Sulfur:
              case Selenium:
              case Tellurium:
                  // valence of three or five are really only for sulphur but
                  // are applied generally to all of group eight for simplicity
                  if (charge == 0) return valence <= 1 || valence == 3 || valence == 5;
                  if (charge == 1) return valence <= 2 || valence == 4;
                  break;
          }
  
          return false;
      }
docs: Determine if the specified element with the provided charge and valance
  requires a pi bond?
  
  @param element atomic number >= 0
  @param charge  formal charge
  @param valence bonded electrons
  @return a double-bond is required