This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes help need for java array coding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help need for java array coding" Watch "help need for java array coding" New topic
Author

help need for java array coding

melun darshandhari
Greenhorn

Joined: Mar 27, 2010
Posts: 4
A number can be encoded as an integer array as follows. The first element of the array is any number and if it is negative then the encoded number is negative. Each digit of the number is the absolute value of the difference of two adjacent elements of the array. The most significant digit of the number is the absolute value of the difference of the first two elements of the array. For example, the array {2, -3, -2, 6, 9, 18} encodes the number 51839 because
· 5 is abs(2 - (-3))
· 1 is abs(-3 - (-2))
· 8 is abs(-2 - 6)
· 3 is abs(6-9)
· 9 is abs(9-18)
The number is positive because the first element of the array is >= 0.
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Hello. What is your question? What code are you having problems with?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help need for java array coding
 
Similar Threads
Sun Cirtification
Expalin the answer -- Arrays
Need definitions of nextInt(), abs() and some other questions
Guidelines for 'extenders' of a class
Why NumberFormatException ???