Question: Why **import org.apache.commons.lang.StringUtils** cannot be imported in android by default.

Do i have to include an external library? Then where can i find that library on the web?

```
package com.myapps.urlencoding;

import android.app.Activity;
import org.apache.commons.lang.StringUtils;

public class EncodeIdUtil extends Activity {
    /** Called when the activity is first created. */
     private static Long multiplier=Long.parseLong("1zzzz",36);

        /**
         * Encodes the id.
         * @param id the id to encode
         * @return encoded string
         */
        public static String encode(Long id) {
            return StringUtils.reverse(Long.toString((id*multiplier), 35));
        }

        /**
         * Decodes the encoded id.
         * @param encodedId the encodedId to decode
         * @return the Id
         * @throws IllegalArgumentException if encodedId is not a validly encoded id.
         */
        public static Long decode(String encodedId) 
            throws IllegalArgumentException {
            long product;
            try {
                product = Long.parseLong(StringUtils.reverse(encodedId), 35);
            } catch (Exception e) {
                throw new IllegalArgumentException();
            }
            if ( 0 != product % multiplier || product < 0) {
                throw new IllegalArgumentException();
            }
            return product/multiplier;
        }
}

```

Answer: 
You don't say whether you are using Eclipse or Android Studio. In Android Studio, you would add,

```
import org.apache.commons.lang3.StringUtils;

```

to your source code file. In build.gradle, you need to change your dependency from something like,

```
dependencies {
    compile 'com.android.support:support-v4:+'
}

```

to

```
dependencies {
    compile 'com.android.support:support-v4:+'
    compile  'org.apache.commons:commons-lang3:3.0'
}

```

In other words, you would add to the dependency.
If you are using Android Studio try to use workflow provided to add dependencies rather than manually adding the downloaded library or manually changing gradle files. 

1. File -> Project Structure -> Modules -> app -> Dependencies Tab
2. Click '+' in the bottom left corner and select "Library dependency"
3. In the search field type: "org.apache.commons:commons-lang3" and click Search
4. Select "org.apache.commons:commons-lang3:3.7"

[![enter image description here](https://i.stack.imgur.com/XFSMO.png)](https://i.stack.imgur.com/XFSMO.png)