KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > caching > Pi


1 /**************************************************************************************
2  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3  * http://aspectwerkz.codehaus.org *
4  * ---------------------------------------------------------------------------------- *
5  * The software in this package is published under the terms of the LGPL license *
6  * a copy of which has been included with this distribution in the license.txt file. *
7  **************************************************************************************/

8 package examples.caching;
9
10 /**
11  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
12  */

13 public class Pi {
14
15     public int getPiDecimal(int n) {
16         System.out.println("Pi.getPiDecimal");
17         String JavaDoc decimals = "141592653";
18         if (n > decimals.length()) {
19             return 0;
20         } else {
21             return Integer.parseInt(decimals.substring(n, n + 1));
22         }
23     }
24 }
Popular Tags