code: public Scanner useLocale(Locale locale) {
          if (locale.equals(this.locale))
              return this;
  
          this.locale = locale;
          DecimalFormat df =
              (DecimalFormat)NumberFormat.getNumberInstance(locale);
          DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale);
  
          // These must be literalized to avoid collision with regex
          // metacharacters such as dot or parenthesis
          groupSeparator =   "\\" + dfs.getGroupingSeparator();
          decimalSeparator = "\\" + dfs.getDecimalSeparator();
  
          // Quoting the nonzero length locale-specific things
          // to avoid potential conflict with metacharacters
          nanString = "\\Q" + dfs.getNaN() + "\\E";
          infinityString = "\\Q" + dfs.getInfinity() + "\\E";
          positivePrefix = df.getPositivePrefix();
          if (positivePrefix.length() > 0)
              positivePrefix = "\\Q" + positivePrefix + "\\E";
          negativePrefix = df.getNegativePrefix();
          if (negativePrefix.length() > 0)
              negativePrefix = "\\Q" + negativePrefix + "\\E";
          positiveSuffix = df.getPositiveSuffix();
          if (positiveSuffix.length() > 0)
              positiveSuffix = "\\Q" + positiveSuffix + "\\E";
          negativeSuffix = df.getNegativeSuffix();
          if (negativeSuffix.length() > 0)
              negativeSuffix = "\\Q" + negativeSuffix + "\\E";
  
          // Force rebuilding and recompilation of locale dependent
          // primitive patterns
          integerPattern = null;
          floatPattern = null;
  
          return this;
      }
docs: Sets this scanner's locale to the specified locale.
  
  <p>A scanner's locale affects many elements of its default
  primitive matching regular expressions; see
  <a href= "#localized-numbers">localized numbers</a> above.
  
  <p>Invoking the {@link #reset} method will set the scanner's locale to
  the <a href= "#initial-locale">initial locale</a>.
  
  @param locale A string specifying the locale to use
  @return this scanner