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: 
If you want the length of trailing zeroes, you could do this regex :

```
public static void main(String[] args) {
    String s = "8320987112741390144276341183223364380754172606361245952449277696409600000000000000";
    Pattern p = Pattern.compile("0+$");
    Matcher m = p.matcher(s);
    m.find();
    String val = m.group();
    System.out.println(val);
    System.out.println(val.length());

}

```

O/P :

```
00000000000000
14

```
well - this is simple but a compute-intesiv solution...

```
String str = "8320987112741390144276341183223364380754172606361245952449277696409600000000000000";
System.out.println(str);
int count = 0;
char c = '0';
do {
    c = str.charAt(str.length()-1);
    if (c == '0' ){
        str = str.substring(0, str.length() - 1);
        count ++;
    }
}while(c == '0' );
System.out.println(str);
System.out.println("amount:"+amount);

```

but it's a very obvious solution... (just remove last zero...until there is no more...)