public class classCari {
private int [] angka=new int[999999];
public int i;
public int getAngka(int i){
return angka[i];
}
public void setAngka(int cari, int i){
angka[i]=cari;
}
}
class utamanya
public class caridata {
public static void main(String []args)throws IOException{
try {
int [] angka = new int [999999];
int b;
int z=0;
int jumlah=0;
int data;
classCari rai = new classCari();
BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
System.out.print("masukkan jumlah angka yang ingin di input:");
b = Integer.parseInt(in.readLine());
angka = new int[b];
for(int i=0;i
if (data==angka[i]){
rai.setAngka(data, i);
z++;
System.out.println("Angka "+rai.getAngka(i)+" ditemukan di array ke-: "+(i+1));
}
jumlah=z*data;
}
System.out.println("Angka "+data+" sebanyak "+ z +" dan jumlahnya = " +jumlah);
}
catch (IOException e) {throw e;
} catch(Exception e) {
throw new RuntimeException("Inputan Anda Salah");
}
}
}