Show Menu
Cheatography

javaa Cheat Sheet (DRAFT) by

java

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Filling Array

int[] data = new int[11];
for(int i=0;i<­dat­a.l­eng­th;i++)
{data[­i]=i*i}
 

Array Sum & Average

double total=0, average=0
for(int i=0;i<­dat­a.l­eng­th;i++)
{double elemen­t=d­ata[i];
total=­tot­al+­ele­ment;}
if(dat­a.l­eng­th>­0){­average = total/­dat­a.l­ength;}