code: public static BidiFormatter getInstance(Dir contextDir) {
      switch (contextDir) {
        case LTR:
          return DEFAULT_LTR_INSTANCE;
        case RTL:
          return DEFAULT_RTL_INSTANCE;
        case NEUTRAL:
          throw new IllegalArgumentException("invalid context directionality: " + contextDir);
      }
      throw new AssertionError(contextDir);
    }
docs: Factory for creating an instance of BidiFormatter given the context directionality. {@link
  #spanWrap} avoids span wrapping unless there's a reason ('dir' attribute should be appended).
  
  @param contextDir The context directionality. Must be RTL or LTR.