Question: I am new to LINUX. This question sounds simple and stupid, but I suppose this has a lot of meaning behind it. "HOW COMMANDS ARE PROCESSED IN LINUX?". Which means suppose if I give ls command,what makes it to display list of all files inside the directory?. I have been searching for the answer, and I could not find any clear explanation for the same. Please help me to solve the same.

Answer: 
The simplest option would probably be to use `String.replaceAll`:

```
text = text.replaceAll("[0.]*$", "");

```

The `$` makes sure it's only trimming the end of the string.

Note that if you start with "0" you'll end up with an empty string - think about what you want the result to be in that situation.
Does this answer fulfills your requirement?

```
String str = "8320987112741390144276341183223364380754172606361245952449277696409600000000000000";
    String withoutTrailingZeroes = "";
    for (int i = str.length() - 1; i >= 0; i--) {
        String charFromString = Character.toString(str.charAt(i));
        if (charFromString.equals("0")) {
            withoutTrailingZeroes += str.charAt(i);
        } else {
            break;
        }
    }
    System.out.println(str);
    System.out.println(str.replace(withoutTrailingZeroes, "")); // string without trailing zeros
    System.out.println(withoutTrailingZeroes); // trailing zeroes
    System.out.println(withoutTrailingZeroes.length()); // trailing zeroes length

```