Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: arithematic operation on arrays

1. ## arithematic operation on arrays

can anybody tell me how we can divide an integer array with another integer array..

Example- 12345/243

As 12345 will be as
numberarray[0]=1;
numberarray[1]=2;
numberarray[2]=3;
numberarray[3]=4;

is to be divided by another array secondarray as 243
secondarray[0]=2;
secondarray[1]=4;
secondarray[2]=3;

2. ## Re: arithematic operation on arrays

What does the array's contents represent?
What is the value represented by each slot in the array?
What value is in slot 0?
What value is in slot 1?

What results are you expecting?

3. ## Re: arithematic operation on arrays

there could be any value . i just need to divide one number which exceeds the limit of int and long (may be 50 digit number) with other 50 digit number and i don't have to use biginteger in java. so there is only other way is arrays. so i am not able to find out how to divide the values in arrays.

4. ## Re: arithematic operation on arrays

If you can't use the BigNumber classes and must use arrays to hold the digits for the number you will need to work out an algorithm for doing the division. Take a piece of paper and a pencil, write out digits for the two arrays and a results array and see what it will take to do the division. I've never seen this problem worked out and don't have any ideas other than to do some experimenting on paper to see how to do it.

Some observations
For the number 12345
the digit in [0] is * 10^4
the digit in [4] is * 10^0