title: Android Studio: I want remove the comma in the number, but after I remove the comma, the output become weird
body: <p>I had removed the comma in the number, but after I remove the comma, the output become weird.
  I implemented this code but getting weird for the output number like I inputing 333333.33 will come out with 333333.34.
  How to solve this problem? Anyone can help me?</p>
  <pre><code>binding.invdtlUnitpriceTxt.addTextChangedListener(new TextWatcher() {
              @Override
              public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
  
              @Override
              public void onTextChanged(CharSequence s, int start, int before, int count)
              {
                  if (s.length() == 0) {
                      invoiceDetails.setUPrice(0.00f);
                      return;
                  }
  
                  binding.invdtlUnitpriceTxt.removeTextChangedListener(this);
  
                  /*
                   * Clear input to get clean text before format
                   * '\u0020' is empty character
                   */
                  String text = s.toString();
                  String result = &quot;&quot;;
                  text = text.replaceAll(&quot;[^\\d]&quot;, &quot;&quot;);
  
                  try {
                      text = format(text);
                      result = text.replace(&quot;,&quot; ,&quot;&quot;);
                      invoiceDetails.setUPrice(Float.parseFloat(result));
                      Calculation();
                  } catch (NumberFormatException e) {
                      Log.e(getClass().getCanonicalName(), e.getMessage());
                  } catch (NullPointerException e) {
                      Log.e(getClass().getCanonicalName(), e.getMessage());
                  }
  
                  binding.invdtlUnitpriceTxt.setText(result);
                  binding.invdtlUnitpriceTxt.setSelection(result.length());
  
                  binding.invdtlUnitpriceTxt.addTextChangedListener(this);
              }
  </code></pre>