intermediate/TraditionalCount

From ggc

Jump to: navigation, search

01 package intermediate;
02 
03 import wiki.Wiki;
04 
05 /**
06  * All about my application.
07  @author My Name Here
08  */
09 public class TraditionalCount
10 {
11   public static void main(String[] args)
12   {
13     int[] nums={45264256};
14     int target=4;
15     int count=0;
16     for(int i=0; i<nums.length-1; i++)
17     {
18       if(i-1>=&& i-1<nums.length)
19       {
20         if(nums[i-1]==target)
21         {
22           count++;
23         }
24       }
25       if(nums[i+1]==target)
26       {
27         count++;
28       }
29     }
30     Wiki.out.println("The count is "+count);
31   }
32 }


Download/View intermediate/TraditionalCount.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter