Results 1 to 6 of 6
Thread: Best way to do the following?
- 12-05-2009, 06:20 AM #1
Member
- Join Date
- Nov 2008
- Posts
- 43
- Rep Power
- 0
Best way to do the following?
I have an array of type byte[4] that is length four.
These bytes all combined together represent a single number
I need to add a variable number to this representation.
What is the easiest way to do this?
So for example lets assume the four bytes represent the number 32453245, I need to add lets say 53445 to the number representing in the array.
Thank You
- 12-05-2009, 07:23 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
What is the easiest way to do this?
So for example lets assume the four bytes represent the number 32453245, I need to add lets say 53445 to the number representing in the array.
32453245+53445?
But surely you mean something else?
- 12-05-2009, 07:29 AM #3
Member
- Join Date
- Nov 2008
- Posts
- 43
- Rep Power
- 0
What I am trying exactly to do is take a WAV file and edit it.
When I do this I need to change the 5-8 bytes in this file because these four bytes represent the whole file size. When I edit the WAV file the size will always grow, so what I need to do is take what ever number is represented by these four bits add integer X to this number and then store it back in these four bits.
- 12-05-2009, 07:36 AM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
OK. Let me make a wild guess...
You say
But do you know how the bytes represent a number? If not you will have to google about, find and read the specifications for a .wav file.These bytes all combined together represent a single number
- 12-05-2009, 07:39 AM #5
Member
- Join Date
- Nov 2008
- Posts
- 43
- Rep Power
- 0
Yes i know how they combine to make a number, I do not however know how in java to make them do so. an array of 4 bytes is usless to me, i need ot know the int value.
- 12-05-2009, 07:50 AM #6
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
Yes i know how they combine to make a number, I do not however know how in java to make them do so.
Good. Perhaps if you describe the process someone will be able to say how it might be written as Java code. (And the reverse, because you will need that after you have figured out the new file length.)


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks