# problem in args

• 08-25-2008, 02:16 PM
MS_Dark
problem in args
hi alll
i have proglem in this question

write a program , get one number Example : 25 and print Twenty five.
we must use >>>> intiger.parseint(args(0))

can help me ???? i must solve that to 1 hour:confused:
• 08-25-2008, 02:28 PM
Eranga
What you have done up to now?
• 08-25-2008, 02:34 PM
MS_Dark
i know how write with for , or another . but i diidnt know how write with
intiger.parseint(args(0))
• 08-25-2008, 02:49 PM
Eranga
parseInt() used to convert string into an int value, using wrapper class.

Code:

`int i = Integer.parseInt("12");`
In that way you can handle the string argument.
• 08-25-2008, 03:00 PM
MS_Dark
hmm . ko i know that but how convert :-?? you can write a simple , to convert this 66524 :-??
• 08-25-2008, 03:22 PM
Norm
int i = Integer.parseInt("66524");
• 08-25-2008, 04:05 PM
sukatoa
@OP,

If you're convinced with there suggested solution, don't forget to mark this thread as solved.....
• 08-25-2008, 04:54 PM
Eranga
Quote:

Originally Posted by MS_Dark
hmm . ko i know that but how convert :-?? you can write a simple , to convert this 66524 :-??

If you know how to convert what's question you have here.
• 08-26-2008, 09:42 AM
MS_Dark
Thank You
Thank You all friend , sorry that question was one of my friend , and i didint know what about that :-??
Thank you again , and i have question (this is for my :D )

i have on array like this >>> int[] arr1 = new int[] {4,1,3,6,87,3};

now i have some repetitious value i sort that and now i want to remove repetitious value,can help me ?

how can remove one value in array
• 08-26-2008, 10:24 AM
Eranga
In an array you cant to do. So you have to use another collection, like an ArrayList.

You can rebuild an array, basically remove element you don't want to include while copying elements, if you know the index.

Here is a simple way.

Code:

```public class CoppyArray {     /**     * @param args the command line arguments     */     public static void main(String[] args) {         // TODO code application logic here         int[] val = new int[]{1, 2, 3, 4, 5};         int[] newVal = removeElement(3, val);         for(int i = 0; i < newVal.length; i++) {             System.out.println(newVal[i]);         }     }         public static int[] removeElement(int index, int[] arr) {         int[] copy = new int[arr.length - 1];         System.arraycopy(arr, 0, copy, 0, index);         System.arraycopy(arr, index + 1, copy, index, copy.length - index);         return copy;     } }```
• 08-26-2008, 02:29 PM
Norm
Quote:

i want to remove repetitious value
If you remove a value from an array, does the size of the array change?
To remove a duplicate value, first search the array for the dup, save its index, then make a new array, in a loop copy from the first array to the second array, skipping over the dup entry. Then set the array reference variable to the new array.
• 08-26-2008, 06:36 PM
Eranga
Quite similar thing I have done in my last post. But I'm not courage to follow that way, if you don't need further the original array. It's just a memory waist. To copy array goes on process with higher memory in reasonable level. It can cause many issues of your original array has large number of elements.
• 08-26-2008, 10:48 PM
MS_Dark
ok thank you .
yes Norm is right , i think best way copy one to another array and i must didit set array size.
thank you again , i love this site , and best users.
• 08-27-2008, 01:43 AM
Eranga
If you have solve the thread please mark it as solved. It can be really helpful to all other members.