This week's book giveaways are in the JBoss and Spring forums.
We're giving away four copies each of JBoss AS 5 Development and Spring Dynamic Modules in Action and have the authors on-line!
See this thread and this one for details.
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of JBoss AS 5 Development this week in the JBoss forum
or Spring Dynamic Modules in Action in the Spring forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Java in General
 
RSS feed
 
New topic
Author

Calculating CRC 16 in java

polo rao
Greenhorn

Joined: Apr 28, 2009
Messages: 6

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

This message was edited 1 time. Last update was at by polo rao

polo rao
Greenhorn

Joined: Apr 28, 2009
Messages: 6

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
Sheriff

Joined: Mar 22, 2005
Messages: 26107

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?

Java web chartsImageJ PluginsSpecification URLsJava FAQs
Rob Prime
Bartender

Joined: Oct 27, 2005
Messages: 8261

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
How To Ask Questions How To Answer Questions
polo rao
Greenhorn

Joined: Apr 28, 2009
Messages: 6

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

This message was edited 1 time. Last update was at by polo rao

Henry Wong
author
Bartender

Joined: Sep 28, 2004
Messages: 9549

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)
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Java in General
 
RSS feed
 
New topic
The most intelligent Java IDE