Click here to Skip to main content
15,887,928 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Someone please explain what does this code do ... i m working on audio steganography
for(i=24, j=0; i>=0; i-=8, j++)
{
tempInt= inputFileSize;
tempInt>>= i;
tempInt&= 0x000000FF;
tempByte[j]= (byte) tempInt;
}

What I have tried:

why the loop starts from 24??.
Posted
Updated 6-Mar-17 10:22am
Comments
Richard MacCutchan 6-Mar-17 5:33am    
How can anyone answer such a question? We have no idea where this code comes from or what it is supposed to do. I already explained that this forum is not able to teach you programming. If you do not understand the code then you should get hold of a good reference book.

The code is splitting the 32-bit number inputFileSize into 4 bytes stored to tempByte[] in reverse order. It is similar to
Java
tempByte[0] = (inputFileSize >> 24) & 0xff;
tempByte[1] = (inputFileSize >> 16) & 0xff;
tempByte[2] = (inputFileSize >> 8) & 0xff;
tempByte[3] = inputFileSize & 0xff;

The loop starts at 24 because that is by how many bits the highest byte must be shifted to get it into the position of an 8-bit value.
 
Share this answer
 
Comments
Member 12910589 6-Mar-17 5:51am    
thank u for this.. do u know how to implement Audio Steganography...
Jochen Arndt 6-Mar-17 6:00am    
Sorry, no.

"Audio Steganography" is a wide subject. You need to narrow it down by some specifications like type of audio carrier data like WAV and type of encoder.

There are many resources on the net which should help and there may be even existing implementations. Just search for the keywords that match your requirements and specifications.
Member 12910589 6-Mar-17 6:55am    
i have an existing code but dont know how it works will u explain that please.
Jochen Arndt 6-Mar-17 7:13am    
Sorry, but that is not the purpose of this site.

We will answer short questions but will not provide detailed services.
We are all volunteers here without getting paid and have to do our normal jobs too.

You will also learn better and faster if you try to understand existing code yourself. This requires at least basic knowledge of the used programming language.
Member 12910589 6-Mar-17 7:16am    
Oh,, thank u ... will learn those ... and will u please guide me for that.
When you don't understand what your code is doing or why it does what it does, the answer is debugger.
Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it is an incredible learning tool.

Debugger - Wikipedia, the free encyclopedia[^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]

The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900