File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Calculating CRC 16 in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calculating CRC 16 in java " Watch "Calculating CRC 16 in java " New topic
Author

Calculating CRC 16 in java

polo rao
Greenhorn

Joined: Apr 28, 2009
Posts: 8
Hi , i need to do a project which wants me to calculate CRC 16 in java without using lookup table
Can anybody guide me about how we code for CRC16 in java
I know Java has CRC32 package but i dont see how it can help me

Thanks in advance
polo rao
Greenhorn

Joined: Apr 28, 2009
Posts: 8
Can anyone please help me. I was really pissed off , trying to figure out how to do it all night.and i have to submit my code by monday
Any help will be appreciated
Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
What do you have so far? Do you understand the algorithm for CRC in general? If so, what stops you from implementing it? If not, do you have material that explains it?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

I would have said to check the source of CRC32, but its important methods are native.

Using Google, I found two results you may be able to use. The first one uses a lookup table though, but the seecond one surely does not.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
polo rao
Greenhorn

Joined: Apr 28, 2009
Posts: 8
Thanks Rob for your reply.
I wanted to know , in the 2nd link

Isnt this line initialising a generator polynomial , to create a lookup table in program.
I dont know if it really does , but was just puzzled about what is its use in program
Thanks

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19060
    
  40

Isnt this line initialising a generator polynomial , to create a lookup table in program.
I dont know if it really does , but was just puzzled about what is its use in program


The reason lookup tables are *not* allowed in a homework assignment is because it is possible to develop the CRC code without knowing how CRC works. And the purpose of the assignment is to learn how CRC works.

Anyway, do you know how CRC works? If you don't, I recommend that you do that first -- coding by cut and paste may get you done with the assignment, but you don't really learn much.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
sindhu sheela
Greenhorn

Joined: May 20, 2008
Posts: 26
the second one (the second mentioned href)uses a package "javazoom.jl.decoder" can i know which jar file/required library is it?
i need to implement the below
CRC-16 modbus (Polynomial =
0xA001 ( initialize data is 0xffff) check sum.

thanks in advance
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

javazoom.jl.decoder
The first hit gives you the Javadocs of the library. From that you should be able to find a download link.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating CRC 16 in java