code: public static int getBestAlignmentForLabel(IAtomContainer container, IAtom atom) {
          double overallDiffX = 0;
          for (IAtom connectedAtom : container.getConnectedAtomsList(atom)) {
              overallDiffX += connectedAtom.getPoint2d().x - atom.getPoint2d().x;
          }
          if (overallDiffX <= 0) {
              return 1;
          } else {
              return -1;
          }
      }
docs: Determines the best alignment for the label of an atom in 2D space. It
  returns 1 if left aligned, and -1 if right aligned.
  See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
  
  @param  container  Description of the Parameter
  @param  atom       Description of the Parameter
  @return            The bestAlignmentForLabel value