<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webmasterwords &#187; Java</title>
	<atom:link href="http://www.webmasterwords.com/category/java/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webmasterwords.com</link>
	<description>Useful snippets for Webmasters</description>
	<lastBuildDate>Wed, 21 Sep 2011 15:55:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Pagerank Checksum in Java</title>
		<link>http://www.webmasterwords.com/pagerank-checksum-in-java?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pagerank-checksum-in-java</link>
		<comments>http://www.webmasterwords.com/pagerank-checksum-in-java#comments</comments>
		<pubDate>Wed, 11 Oct 2006 08:49:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.webmasterwords.com/pagerank-checksum-in-java</guid>
		<description><![CDATA[A quick java class to calculate a web pages Page Rank Checksum. It can be used to obtian the Google Page Rank for a given url.The code is reverse engineered from the javascript used to build the Firefox page rank plugin. It calculates a checksum using a encoding algorithm.

[java]

public class Pagerank
{

private String toHex8(int num)
{
if(num>>23&#124;key>(8&#038;255))+toHex8(key&#038;255);

}
}[/java]]]></description>
			<content:encoded><![CDATA[<p>A quick java class to calculate a web pages Page Rank Checksum. It can be used to obtian the Google Page Rank for a given url.The code is reverse engineered from the javascript used to build the Firefox page rank plugin. It calculates a checksum using a encoding algorithm.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Pagerank
<span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> toHex8<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> num<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>num<span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">+</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">toHexString</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">Integer</span>.<span style="color: #006633;">toHexString</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> calculateChecksum<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> url<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #003399;">String</span> stupidGoogleHash <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Mining PageRank is AGAINST GOOGLEâ€™S TERMS OF SERVICE. Yes, Iâ€™m talking to you, scammer.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> key <span style="color: #339933;">=</span> <span style="color: #cc66cc;">16909125</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> url.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
key <span style="color: #339933;">=</span> key <span style="color: #339933;">^</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>stupidGoogleHash.<span style="color: #006633;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">%</span>stupidGoogleHash.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">^</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>url.<span style="color: #006633;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
key <span style="color: #339933;">=</span> key<span style="color: #339933;">&gt;&gt;&gt;</span><span style="color: #cc66cc;">23</span><span style="color: #339933;">|</span>key<span style="color: #339933;">&lt;&lt;</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;8&quot;</span><span style="color: #339933;">+</span>toHex8<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">&gt;&gt;&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">&amp;</span>#038<span style="color: #339933;">;</span><span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>toHex8<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">&amp;</span>#038<span style="color: #339933;">;</span><span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.webmasterwords.com/pagerank-checksum-in-java/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

