r/javahelp • • Nov 17 '18

Unsolved What would be faster? Using shorts or using ints? With ints, id think it'd be slower than shorts but allow comfort for my reset memory, whereas shorts would be faster but burn through my resets to the point id have to expand it to a double or long. Thought process in middle of code, big paragraph. NSFW

293 Upvotes

package c.pkg39;

public class C39 {

public static void oof()

{

int everything;

long one = 0;

long two = 0;

long three = 0;

long four = 0;

long five = 0;

long six = 0;

long seven = 0;

long eight = 0;

long nine = 0;

long ten = 0;

long eleven = 0;

long twelve = 0;

long thirteen = 0;

long fourteen = 0;

long fifteen = 0;

long sixteen = 0;

long seventeen = 0;

long eightteen = 0;

long nineteen = 0;

long twenty = 0;

long twentyone = 0;

long twentytwo = 0;

long twentythree = 0;

long twentyfour = 0;

long twentyfive = 0;

long twentysix = 0;

long twentyseven = 0;

long twentyeight = 0;

long twentynine = 0;

long thirty = 0;

long thirtyone = 0;

long thirtytwo = 0;

long thirtythree = 0;

long thirtyfour = 0;

long thirtyfive = 0;

long thirtysix = 0;

long thirtyseven = 0;

long thirtyeight = 0;

long thirtynine = 0;

long fourty = 0;

long fourtyone = 0;

long fourtytwo = 0;

long fourtythree = 0;

long fourtyfour = 0;

long fourtyfive = 0;

long fourtysix = 0;

long fourtyseven = 0;

long fourtyeight = 0;

long fourtynine = 0;

long fifty = 0;

long fiftyone = 0;

long fiftytwo = 0;

long fiftythree = 0;

long fiftyfour = 0;

long fiftyfive = 0;

long fiftysix = 0;

long fiftyseven = 0;

long fiftyeight = 0;

long fiftynine = 0;

long sixty = 0;

long sixtyone = 0;

long sixtytwo = 0;

long sixtythree = 0;

long sixtyfour = 0;

long sixtyfive = 0;

long sixtysix = 0;

long sixtyseven = 0;

long sixtyeight = 0;

long sixtynine = 0;

long seventy = 0;

long counter = 0L;

for(long k = 0L; k < 1; k--)

{

counter--;

everything = (int)(Math.random()*24 + 1);

//System.out.print(everything);

if(everything == 1)

{

one++;

}

if(everything == 2)

{

two++;

}

if(everything == 3)

{

three++;

}

if(everything == 4)

{

four++;

}

if(everything == 5)

{

five++;

}

if(everything == 6)

{

six++;

}

if(everything == 7)

{

seven++;

}

if(everything == 8)

{

eight++;

}

if(everything == 9)

{

nine++;

}

if(everything == 10)

{

ten++;

}

if(everything == 11)

{

eleven++;

}

if(everything == 12)

{

twelve++;

}

if(everything == 13)

{

thirteen++;

}

if(everything == 14)

{

fourteen++;

}

if(everything == 15)

{

fifteen++;

}

if(everything == 16)

{

sixteen++;

}

if(everything == 17)

{

seventeen++;

}

if(everything == 18)

{

eightteen++;

}

if(everything == 19)

{

nineteen++;

}

if(everything == 20)

{

twenty++;

}

if(everything == 21)

{

twentyone++;

}

if(everything == 22)

{

twentytwo++;

}

if(everything == 23)

{

twentythree++;

}

if(everything == 24)

{

twentyfour++;

}

if(everything == 25)

{

twentyfive++;

}

if(everything == 26)

{

twentysix++;

}

if(everything == 27)

{

twentyseven++;

}

if(everything == 28)

{

twentyeight++;

}

if(everything == 29)

{

twentynine++;

}

if(everything == 30)

{

thirty++;

}

if(everything == 31)

{

thirtyone++;

}

if(everything == 32)

{

thirtytwo++;

}

if(everything == 33)

{

thirtythree++;

}

if(everything == 34)

{

thirtyfour++;

}

if(everything == 35)

{

thirtyfive++;

}

if(everything == 36)

{

thirtysix++;

}

if(everything == 37)

{

thirtyseven++;

}

if(everything == 38)

{

thirtyeight++;

}

if(everything == 39)

{

thirtynine++;

}

if(everything == 40)

{

fourty++;

}

if(everything == 41)

{

fourtyone++;

}

if(everything == 42)

{

fourtytwo++;

}

if(everything == 43)

{

fourtythree++;

}

if(everything == 44)

{

fourtyfour++;

}

if(everything == 45)

{

fourtyfive++;

}

if(everything == 46)

{

fourtysix++;

}

if(everything == 47)

{

fourtyseven++;

}

if(everything == 48)

{

fourtyeight++;

}

if(everything == 49)

{

fourtynine++;

}

if(everything == 50)

{

fifty++;

}

if(everything == 51)

{

fiftyone++;

}

if(everything == 52)

{

fiftytwo++;

}

if(everything == 53)

{

fiftythree++;

}

if(everything == 54)

{

fiftyfour++;

}

if(everything == 55)

{

fiftyfive++;

}

if(everything == 56)

{

fiftysix++;

}

if(everything == 57)

{

fiftyseven++;

}

if(everything == 58)

{

fiftyeight++;

}

if(everything == 59)

{

fiftynine++;

}

if(everything == 60)

{

sixty++;

}

if(everything == 61)

{

sixtyone++;

}

if(everything == 62)

{

sixtytwo++;

}

if(everything == 63)

{

sixtythree++;

}

if(everything == 64)

{

sixtyfour++;

}

if(everything == 65)

{

sixtyfive++;

}

if(everything == 66)

{

sixtysix++;

}

if(everything == 67)

{

sixtyseven++;

}

if(everything == 68)

{

sixtyeight++;

}

if(everything == 69)

{

sixtynine++;

}

if(everything == 70)

{

seventy++;

}

/*

System.out.println("One:" + one);

System.out.println("Two:" + two);

System.out.println("Three:" + three);

System.out.println("Four:" + four);

System.out.println("Five:" + five);

System.out.println("Six:" + six);

System.out.println("Seven:" + seven);

System.out.println("Eight:" + eight);

System.out.println("Nine:" + nine);

System.out.println("Ten:" + ten);

System.out.println("Eleven:" + eleven);

System.out.println("Twelve:" + twelve);

System.out.println("Thirteen:" + thirteen);

System.out.println("Fourteen:" + fourteen);

System.out.println("Fifteen:" + fifteen);

System.out.println("Sixteen:" + sixteen);

System.out.println("Seventeen:" + seventeen);

System.out.println("Eighteen:" + eightteen);

System.out.println("Nineteen:" + nineteen);

System.out.println("Twenty:" + twenty);

System.out.println("Twentyone:" + twentyone);

System.out.println("Twentytwo:" + twentytwo);

System.out.println("Twnetythree:" + twentythree);

System.out.println("Twentyfour:" + twentyfour);

System.out.println("Twentyfive:" + twentyfive);

System.out.println("Twentysix:" + twentysix);

System.out.println("Twentyseven:" + twentyseven);

System.out.println("Twentyeight:" + twentyeight);

System.out.println("Twnetynine:" + twentynine);

System.out.println("Thirty:" + thirty);

System.out.println("Thirtyone:" + thirtyone);

System.out.println("Thirtytwo:" + thirtytwo);

System.out.println("Thirtythree:" + thirtythree);

System.out.println("Thirtyfour:" + thirtyfour);

System.out.println("Thirtyfive:" + thirtyfive);

System.out.println("Thirtysix:" + thirtysix);

System.out.println("Thirtyseven:" + thirtyseven);

System.out.println("Thirtyeight:" + thirtyeight);

System.out.println("Thirtynine:" + thirtynine);

System.out.println("Fourty:" + fourty);

System.out.println("Fourtyone:" + fourtyone);

System.out.println("Fourtytwo:" + fourtytwo);

System.out.println("Fourtythree:" + fourtythree);

System.out.println("Fourtyfour:" + fourtyfour);

System.out.println("Fourtyfive:" + fourtyfive);

System.out.println("Fourtysix:" + fourtysix);

System.out.println("Fourtyseven:" + fourtyseven);

System.out.println("Fourtyeight:" + fourtyeight);

System.out.println("Fourtynine:" + fourtynine);

System.out.println("Fifty:" + fifty);

System.out.println("Fiftyone:" + fiftyone);

System.out.println("Fiftytwo:" + fiftytwo);

System.out.println("Fiftythree:" + fiftythree);

System.out.println("Fiftyfour:" + fiftyfour);

System.out.println("Fiftyfive:" + fiftyfive);

System.out.println("Fiftysix:" + fiftysix);

System.out.println("Fiftyseven:" + fiftyseven);

System.out.println("Fiftyeight:" + fiftyeight);

System.out.println("Fiftynine:" + fiftynine);

System.out.println("Sixty:" + sixty);

System.out.println("Sixtyone:" + sixtyone);

System.out.println("Sixtytwo:" + sixtytwo);

System.out.println("Sixtythree:" + sixtythree);

System.out.println("Sixtyfour:" + sixtyfour);

System.out.println("Sixtyfive:" + sixtyfive);

System.out.println("Sixtysix:" + sixtysix);

System.out.println("Sixtyseven:" + sixtyseven);

System.out.println("Sixtyeight:" + sixtyeight);

System.out.println("Sixtynine:" + sixtynine);

System.out.println("Seventy:" + seventy);

System.out.println();

System.out.println();

*/

int a = (int)Math.max(seventy,one);

int am = (int)Math.min(seventy,one);

int b = (int)Math.max(two,three);

int bm = (int)Math.min(seventy,one);

int c = (int)Math.max(four,five);

int cm = (int)Math.min(seventy,one);

int d = (int)Math.max(six,seven);

int dm = (int)Math.min(seventy,one);

int e = (int)Math.max(eight,nine);

int em = (int)Math.min(seventy,one);

int b1 =(int) Math.max(ten,eleven);

int fm = (int)Math.min(seventy,one);

int b2 = (int)Math.max(twelve,thirteen);

int gm = (int)Math.min(seventy,one);

int b3 = (int)Math.max(fourteen,fifteen);

int hm = (int)Math.min(seventy,one);

int b4 = (int)Math.max(sixteen,seventeen);

int im = (int)Math.min(seventy,one);

int b5 = (int)Math.max(eightteen,nineteen);

int jm = (int)Math.min(seventy,one);

int f = (int)Math.max(twenty,twentyone);

int km = (int)Math.min(seventy,one);

int g = (int)Math.max(twentytwo,twentythree);

int lm = (int)Math.min(seventy,one);

int h = (int)Math.max(twentyfour,twentyfive);

int mm = (int)Math.min(seventy,one);

int i = (int)Math.max(twentysix,twentyseven);

int nm = (int)Math.min(seventy,one);

int j = (int)Math.max(twentyeight,twentynine);

int om = (int)Math.min(seventy,one);

int b6 = (int)Math.max(thirty,thirtyone);

int pm = (int)Math.min(seventy,one);

int l = (int)Math.max(thirtytwo,thirtythree);

int qm = (int)Math.min(seventy,one);

int m = (int)Math.max(thirtyfour,thirtyfive);

int rm = (int)Math.min(seventy,one);

int n = (int)Math.max(thirtysix,thirtyseven);

int sm = (int)Math.min(seventy,one);

int o = (int)Math.max(thirtyeight,thirtynine);

int tm = (int)Math.min(seventy,one);

int p = (int)Math.max(fourty,fourtyone);

int um = (int)Math.min(seventy,one);

int q= (int)Math.max(fourtytwo,fourtythree);

int vm = (int)Math.min(seventy,one);

int r = (int)Math.max(fourtyfour,fourtyfive);

int wm = (int)Math.min(seventy,one);

int s = (int)Math.max(fourtysix,fourtyseven);

int xm = (int)Math.min(seventy,one);

int t = (int)Math.max(fourtyeight,fourtynine);

int ym = (int)Math.min(seventy,one);

int u = (int)Math.max(fifty,fiftyone);

int zm = (int)Math.min(seventy,one);

int u2 = (int)Math.max(fiftytwo,fiftythree);

int am1 = (int)Math.min(seventy,one);

int u3 = (int)Math.max(fiftyfour,fiftyfive);

int am2 = (int)Math.min(seventy,one);

int u4 = (int)Math.max(fiftysix,fiftyseven);

int am3 = (int)Math.min(seventy,one);

int v = (int)Math.max(fiftyeight,fiftynine);

int am4 = (int)Math.min(seventy,one);

int w = (int)Math.max(sixty,sixtyone);

int am5 = (int)Math.min(seventy,one);

int x = (int)Math.max(sixtytwo,sixtythree);

int am6 = (int)Math.min(seventy,one);

int y = (int)Math.max(sixtyfour,sixtyfive);

int am7 = (int)Math.min(seventy,one);

int z = (int)Math.max(sixty,sixtyone);

int am8 = (int)Math.min(seventy,one);

int a1 = (int)Math.max(sixtytwo,sixtythree);

int am9 = (int)Math.min(seventy,one);

int a2 = (int)Math.max(sixtyfour,sixtyfive);

int am10 = (int)Math.min(seventy,one);

int a3 = (int)Math.max(sixtysix,sixtyseven);

int am11 = (int)Math.min(seventy,one);

int a4 = (int)Math.max(sixtyeight,sixtynine);

int am12 = (int)Math.min(seventy,one);

int xo = Math.min(am,bm);

int xo2 = Math.min(cm,dm);

int xo3 = Math.min(em,fm);

int xo4 = Math.min(gm,hm);

int xo5 = Math.min(im,jm);

int xo6 = Math.min(km,lm);

int xo7 = Math.min(mm,nm);

int xo8 = Math.min(om,pm);

int xo10 = Math.min(qm,rm); //fuck 9

int xo11 = Math.min(sm,tm);

int xo12 = Math.min(um,vm);

int xo13 = Math.min(wm,xm);

int xo14 = Math.min(ym,zm);

int xo15 = Math.min(am1,am2);

int xo16 = Math.min(am3,am4);

int xo17 = Math.min(am5,am6);

int xo18 = Math.min(am7,am8);

int xo19 = Math.min(am9,am10);

int xo20 = Math.min(am11,am12);

int xo21 = Math.min(xo,xo2);

int xo22 = Math.min(xo3,xo4);

int xo23 = Math.min(xo5,xo6);

int xo24 = Math.min(xo7,xo8);

int xo25 = Math.min(xo11,xo10);

int xo26 = Math.min(xo12,xo13);

int xo27 = Math.min(xo14,xo15);

int xo28 = Math.min(xo16,xo17);

int xo29 = Math.min(xo18,xo19); //REPEAT!!!!

int xo30 = Math.min(xo20,xo19);

int xo31 = Math.min(xo21,xo22);

int xo32 = Math.min(xo23,xo24);

int xo33 = Math.min(xo25,xo26);

int xo34 = Math.min(xo27,xo28);

int xo35 = Math.min(xo29,xo30);

int xo36 = Math.min(xo31,xo32);

int xo37 = Math.min(xo33,xo34);

int xo38 = Math.min(xo34,xo35);

int xo39 = Math.min(xo36,xo37);

int xo40 = Math.min(xo37,xo38);

int min = Math.min(xo39,xo40); //rank #70

int c2 = Math.max(a,b);

int c3 = Math.max(d,c);

int c4 = Math.max(e,f);

int c5 = Math.max(g,h);

int c6 = Math.max(i,j);

int c7 = Math.max(b6,l);

int c8 = Math.max(o,p);

int c9 = Math.max(q,r);

int c10 = Math.max(s,t);

int c11 = Math.max(u,v);

int c12 = Math.max(w,x);

int c13 = Math.max(y,z);

int c14 = Math.max(b1,b2);

int c15 = Math.max(b3,b4);

int c16 = Math.max(b5,b6);

int c17 = Math.max(a1,a2);

int c18 = Math.max(a3,a4);

int c19 = Math.max(u2,u3);

int c20 = Math.max(c2,u4); //REPEAT!!!!!!!!!!!!!!!

int c21 = Math.max(c2,c3);

int c22 = Math.max(c4,c5);

int c23 = Math.max(c6,c7);

int c24 = Math.max(c9,c8);

int c25 = Math.max(c11,c10);

int c26 = Math.max(c12,c13);

int c27 = Math.max(c14,c15);

int c28 = Math.max(c17,c16);

int c29 = Math.max(c19,c18);

int c30 = Math.max(c21,c20);

int c31 = Math.max(c23,c22);

int c34 = Math.max(c29,c28);

int c35 = Math.max(c31,c30);

int c32 = Math.max(c25,c24);

int c33 = Math.max(c27,c26);

int c36 = Math.max(c33,c32);

//comp

int c37 = Math.max(c35,c34);

int wo3 = Math.min(c35,c34);

int c38 = Math.max(c37,c36);

int wo2 = Math.min(c37,c36);

int wo4 = Math.min(wo3, wo2); //4

int wo5 = Math.max(wo3, wo2); //3

int wo1 = Math.min(c38,c37); //2

int c39 = Math.max(c38,c37); //1

//System.out.println(counter);

if(counter == -100000)

{

counter = 0;

System.out.println("mode occurence:" + c39);

if(one == c39)

{

System.out.println("mode:" + 1);

}

if(two == c39)

{

System.out.println("mode:" + 2);

}

if(three == c39)

{

System.out.println("mode:" + 3);

}

if(four == c39)

{

System.out.println("mode:" + 4);

}

if(five == c39)

{

System.out.println("mode:" + 5);

}

if(six == c39)

{

System.out.println("mode:" + 6);

}

if(seven == c39)

{

System.out.println("mode:" + 7);

}

if(eight == c39)

{

System.out.println("mode:" + 8);

}

if(nine == c39)

{

System.out.println("mode:" + 9);

}

if(ten == c39)

{

System.out.println("mode:" + 10);

}

if(eleven == c39)

{

System.out.println("mode:" + 11);

}

if(twelve == c39)

{

System.out.println("mode:" + 12);

}

if(thirteen == c39)

{

System.out.println("mode:" + 13);

}

if(fourteen == c39)

{

System.out.println("mode:" + 14);

}

if(fifteen == c39)

{

System.out.println("mode:" + 15);

}

if(sixteen == c39)

{

System.out.println("mode:" + 16);

}

if(seventeen == c39)

{

System.out.println("mode:" + 17);

}

if(eightteen == c39)

{

System.out.println("mode:" + 18);

}

if(nineteen == c39)

{

System.out.println("mode:" + 19);

}

if(twenty == c39)

{

System.out.println("mode:" + 20);

}

if(twentyone == c39)

{

System.out.println("mode:" + 21);

}

if(twentytwo == c39)

{

System.out.println("mode:" + 22);

}

if(twentythree == c39)

{

System.out.println("mode:" + 23);

}

if(twentyfour == c39)

{

System.out.println("mode:" + 24);

}

if(twentyfive == c39)

{

System.out.println("mode:" + 25);

}

if(twentysix == c39)

{

System.out.println("mode:" + 26);

}

if(twentyseven == c39)

{

System.out.println("mode:" + 27);

}

if(twentyeight == c39)

{

System.out.println("mode:" + 28);

}

if(twentynine == c39)

{

System.out.println("mode:" + 29);

}

if(thirty == c39)

{

System.out.println("mode:" + 30);

}

if(thirtyone == c39)

{

System.out.println("mode:" + 31);

}

if(thirtytwo == c39)

{

System.out.println("mode:" + 32);

}

if(thirtythree == c39)

{

System.out.println("mode:" + 33);

}

if(thirtyfour == c39)

{

System.out.println("mode:" + 34);

}

if(thirtyfive == c39)

{

System.out.println("mode:" + 35);

}

if(thirtysix == c39)

{

System.out.println("mode:" + 36);

}

if(thirtyseven == c39)

{

System.out.println("mode:" + 37);

}

if(thirtyeight == c39)

{

System.out.println("mode:" + 38);

}

if(thirtynine == c39)

{

System.out.println("mode:" + 39);

}

if(fourty == c39)

{

System.out.println("mode:" + 40);

}

if(fourtyone == c39)

{

System.out.println("mode:" + 41);

}

if(fourtytwo == c39)

{

System.out.println("mode:" + 42);

}

if(fourtythree == c39)

{

System.out.println("mode:" + 43);

}

if(fourtyfour == c39)

{

System.out.println("mode:" + 44);

}

if(fourtyfive == c39)

{

System.out.println("mode:" + 45);

}

if(fourtysix == c39)

{

System.out.println("mode:" + 46);

}

if(fourtyseven == c39)

{

System.out.println("mode:" + 47);

}

if(fourtyeight == c39)

{

System.out.println("mode:" + 48);

}

if(fourtynine == c39)

{

System.out.println("mode:" + 49);

}

if(fifty == c39)

{

System.out.println("mode:" + 50);

}

if(fiftyone == c39)

{

System.out.println("mode:" + 51);

}

if(fiftytwo == c39)

{

System.out.println("mode:" + 52);

}

if(fiftythree == c39)

{

System.out.println("mode:" + 53);

}

if(fiftyfour == c39)

{

System.out.println("mode:" + 54);

}

if(fiftyfive == c39)

{

System.out.println("mode:" + 55);

}

if(fiftysix == c39)

{

System.out.println("mode:" + 56);

}

if(fiftyseven == c39)

{

System.out.println("mode:" + 57);

}

if(fiftyeight == c39)

{

System.out.println("mode:" + 58);

}

if(fiftynine == c39)

{

System.out.println("mode:" + 59);

}

if(sixty == c39)

{

System.out.println("mode:" + 60);

}

if(sixtyone == c39)

{

System.out.println("mode:" + 61);

}

if(sixtytwo == c39)

{

System.out.println("mode:" + 62);

}

if(sixtythree == c39)

{

System.out.println("mode:" + 63);

}

if(sixtyfour == c39)

{

System.out.println("mode:" + 64);

}

if(sixtyfive == c39)

{

System.out.println("mode:" + 65);

}

if(sixtysix == c39)

{

System.out.println("mode:" + 66);

}

if(sixtyseven == c39)

{

System.out.println("mode:" + 67);

}

if(sixtyeight == c39)

{

System.out.println("mode:" + 68);

}

if(sixtynine == c39)

{

System.out.println("mode:" + 69);

}

if(seventy == c39)

{

System.out.println("mode:" + 70);

}

int resetCount = 0;

if(c39 >= 2147450563)

{

resetCount++;

System.out.println("\n");

System.out.println("[2147450563] Reset count: " + resetCount);

System.out.println("\n");

one -= min;

two -= min;

three -= min;

four -= min;

five -= min;

six -= min;

seven -= min;

eight -= min;

nine -= min;

ten -= min;

eleven -=min;

twelve -= min;

thirteen -= min;

fourteen -= min;

fifteen -= min;

sixteen -= min;

seventeen -= min;

eightteen -= min;

nineteen -= min;

twenty -= min;

twentyone -= min;

twentytwo -= min;

twentythree -= min;

twentyfour -= min;

twentyfive -= min;

twentysix -= min;

twentyseven -= min;

twentyeight -= min;

twentynine -= min;

thirty -= min;

thirtyone -=min;

thirtytwo -= min;

thirtythree -= min;

thirtyfour -= min;

thirtyfive -= min;

thirtysix -= min;

thirtyseven -= min;

thirtyeight -= min;

thirtynine -= min;

fourty -= min;

fourtyone -=min;

fourtytwo -= min;

fourtythree -= min;

fourtyfour -= min;

fourtyfive -= min;

fourtysix -= min;

fourtyseven -= min;

fourtyeight -= min;

fourtynine -= min;

fifty -= min;

fiftyone -=min;

fiftytwo -= min;

fiftythree -= min;

fiftyfour -= min;

fiftyfive -= min;

fiftysix -= min;

fiftyseven -= min;

fiftyeight -= min;

fiftynine -= min;

sixty -= min;

sixtyone -=min;

sixtytwo -= min;

sixtythree -= min;

sixtyfour -= min;

sixtyfive -= min;

sixtysix -= min;

sixtyseven -= min;

sixtyeight -= min;

sixtynine -= min;

seventy -= min;

}

/*

for(int ki = 0; ki < 70; ki++)

{

int difference =

System.out.println();

}

*/

/*

int difference1 = c39 - c38;

int difference2 = c37 - c36;

int difference3 = c35 - c34;

int difference4 = c33 - c32;

int difference5 = c31 - c30;

int difference6 = c29 - c28;

int difference7 = c - c32;

int difference8 = c32 - c31;

int difference9 = c31 - c30;

int difference10 = c30 - c29;

int difference11 = c29 - c28;

int difference12 = c28 - c27;

int difference13 = c27 - c26;

int difference14 = c39 - c38;

int difference15 = c38 - c37;

int difference16 = c37 - c36;

int difference17 = c36 - c35;

int difference18 = c35 - c34;

int difference19 = c34 - c33;

int difference20 = c33 - c32;

int difference21 = c32 - c31;

int difference22 = c31 - c30;

int difference23 = c30 - c29;

int difference24 = c29 - c28;

int difference25 = c28 - c27;

int difference26 = c27 - c26;

int differenc27 = c26 - c25;

int difference28 = c25 - c24;

int difference29 = c24 - c23;

int difference30 = c23 - c22;

int difference31 = c22 - c21;

int difference32 = c21 - c20;

int difference33 = c20 - c19;

int difference34 = c19 - c18;

int difference35 = c18 - c17;

int difference36 = c17 - c16;

int difference37 = c16 - c15;

int difference38 = c15 - c14;

int difference39 = c14 - c13;

int difference40 = c13 - c12;

int difference41 = c12 - c11;

int difference42 = c11 - c10;

int difference43 = c10 - c9;

int difference44 = c9 - c8;

int difference45 = c8 - c7;

int difference46 = c7 - c6;

int difference47 = c6 - c5;

int difference48 = c5 - c4;

int difference49 = c4 - c3;

int difference50 = c3 - c2;

int difference51 = c2 - u4; //c2!!!

int difference52 = u4 - u3;

int difference53 = u3 - u2;

int difference54 = u2 - a4;

int difference55 = a4 - c36;

int difference56 = a3 - c35;

int difference57 = c35 - c34;

int difference58 = c34 - c33;

int difference59 = c33 - c32;

int difference60 = c32 - c31;

int difference61 = c31 - c30;

int difference62 = c30 - c29;

int difference63 = c29 - c28;

int difference64 = c28 - c27;

int difference65 = c27 - c26;

int difference66 = c39 - c38;

int difference67 = c38 - c37;

int difference68 = c37 - c36;

int difference69 = c36 - c35;

int difference70 = c35 - c34;

big idea: im stuck because loop stops at int limit, sacrificing scope for

time. i can manuever around this by simply retrieving all the differences

(or ranks) of each number counter relative to one another and reset all

counters when the int memory limit is reached, but not losing my progress to

a counter of zero for each, but by setting only the lowest rank[(s) if

duplicate lowests which is unlikely] and then setting rank #69 its

difference between itself and the #70 counter ABOVE what #70 is, and so on

with c39 (rank #1) set at its difference from #70 (or difference from #2 and

so on) above 0 when reset is required to prevent counter crash from 2

2 billion to 0. Essentially, im continuing the above code with little

interruption for as long as the earth rotates, saving memory AND speed.

To accomplish this, either ill be a genius and code some complicated 4x

nested 'for' loops... or just hardcode another 500 lines (basically doing

what i did for 'if c39 == six, then six counter++' but now for every other

rank as well, so yeah - or i could make loop that goes thru every counter

ranks them which i might do since its already time-consuming enough to go

through each line of Math.max/min to predict ranks).

*/

}

}

}

//18 sec per 1mill

public static void main(String[] args) {

C39 a1 = new C39();

C39.oof();

{

}

}

}

EDIT: I greatly appreciate all the answers and encouraging support you have all aided me with today! I have to study for AP chem right now, but I'll make sure to return with 70 arrays as requested. Thanks!


r/javahelp • • Oct 15 '20

[PSA] Posts with improperly formatted or unformatted code will be no longer accepted.

121 Upvotes

From now on, this subreddit does no longer accept lazy posts with unformatted or improperly formatted code.

We have plenty information on the subreddit on how to properly format code that there are absolutely no excuses for not doing so.

You are asking for help, so, spend the minimum effort to produce a proper post.

Code is to be formatted as code block or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
         System.out.println("Hello World!");
    }
}

See Automoderator's comment below this post for the minimum requirements.

Do not help on posts with improperly formatted code. You are doing the community a disservice. We want to raise the standards so that it is easy for everyone to help.


r/javahelp • • Oct 11 '25

Senior Java Developers — What’s the one thing you think most junior Java devs are lacking?

113 Upvotes

Hey everyone,
I’m a junior Java developer trying to level up my skills and mindset. I’d really like to hear from experienced Java devs — what’s the one thing (or a few things) you often notice junior developers struggle with or lack?

I’m genuinely looking to improve, so honest answers are appreciated.
Thanks in advance! 🙌


r/javahelp • • Jan 23 '20

New version of University of Helsinki MOOC has been published

106 Upvotes

The long-awaited new English version of the University of Helsinki Java course has finally been published. It is now equivalent to the current Finnish version which is used as the programming course for the university's computer science students.

Course page: java-programming.mooc.fi
Front page of MOOC (contains other courses as well): mooc.fi/en

Note that while the official support channel is now in Telegram, the original IRC channel (#mooc.fi @ IRCnet) is also still up in case you'd rather use IRC.


r/javahelp • • Mar 17 '21

[PSA] Java 16 has just been released which comes with a packaging tool and records!

92 Upvotes

Hi! I wanted to point this out because this comes up a LOT in this sub; 'how do I turn my Java program into an executable'. And then we also see a lot of responses from people who try to help, but are not aware of recent additions.

You can find what is in Java 16 here.

The two most important additions I think for people in this sub are records and the packaging tool

Records are mostly just immutable classes that take away most of the fuss of having to write getters, setters, hashcode, equals and toString. More info here.

Jpackage is a tool that lets you take your program and bundle it with a trimmed down JDK into a native executable / installer. So for Windows it supports msi and exe, for MacOS pkg and dmg. This makes it a lot easier to share whatever you created with others, be it a GUI or a service. More info here.


r/javahelp • • Jun 10 '23

/r/javahelp will be joining the June 12th Blackout in protest of Reddit's API changes. Please support open-source projects and democratization of Projects by using other platforms until we return. This sub will not be accessible for at least 2 days, and possibly longer.

Post image
88 Upvotes

r/javahelp • • Jul 03 '26

Bombed my Java interview today. How should I prepare better?

77 Upvotes

I have 2 years of experience as a Java backend developer and had a 30-minute interview today.

The interviewer focused mainly on Core Java (OOP, String immutability, String Pool, etc.), and I realized my fundamentals aren't as strong as they should be. I mean I had read about it but I forgot to speak under pressure.

I also need to prepare backend topics like Spring Boot, Multithreading, Kafka, Docker, Kubernetes, Redis, Linux, and SQL for upcoming interviews.

If you were in my position, how would you structure your preparation? Core Java first, or prepare everything in parallel? Any roadmap or resources would be appreciated.


r/javahelp • • Feb 01 '24

Why do I like Java so much?

73 Upvotes

I have been coding since college (B.S. in Electrical Engineering).

I've coded in Python, C#, C++, Java, JavaScript/TypeScript.

No matter what language I use, I always end up coming back to Java.

I want to eventually start my own tech company, and I came to the conclusion that TypeScript/Node.js would be the best thing since I can make a modern UI with react and use Node.js for the backend, so the entire application would be in the same language.

But no matter what, I find myself preferring to code in Java. I definitely have the most work experience with Java, I am a SDET, so I've spent a lot of time creating automation testing frameworks and test data generation tools with Java/Selenium/RestAssured/SQL.

While I have 4 years of professional experience with Java, I also have 1.5 years of professional experience with TypeScript/JavaScript. I took my last job specifically to break into the TS/JS work because I think that skillset would be better for me to start my own tech company, but I really struggle to enjoy TS/JS.

For clarification, I don't struggle to code in TS/JS, but I do struggle to enjoy it as much as Java. I just love how explicit and rigorous Java is. Strict typing, and requiring classes for everything really helps me keep my software architected well. But in the TS/JS word, its just filled with anon functions with no names, objects created with no class file, it turns into a mess.

I honestly can't tell if my frustrations are because I really do prefer Java, or I'm just more familiar with it. Does anyone else run into this sort of thing?

I really don't want to be that engineer that has an out of date skillset in 10 years... lol

Edit (update and conclusion):

Thanks everyone for your thoughts and camaraderie. I’ve decided to lean more into what I like and go into Android Development since that space is heavy with Java. I do plan to start learning Kotlin as well because of its similarities to Java.

Best wishes!


r/javahelp • • Apr 28 '22

I got fired as a Junior Java Developer. Any tips for me to start again my career in Development?

70 Upvotes

Hi all, 2 days ago i got fired as a Junior Java Developer. The management told me that i am too slow in doing tasks and couldn't do it in deadlines and that even if i have completed them , i made tasks with the help of the team. Additionally i worked there for 2 months. And for two months they draw conclusions about me. Also management told me that my thinking and solving the problems is not appropriate, and i should solve some algorithms in Leetcode and etc. Also they told me that i didn't know some technologies and they gave me 2 days for study it, and told me that they paid me for my study for these 2 days instead of working and solving the problems. So i hope I could tell you the reasons of my firing, ANY TIPS FOR ME not to again repeat my mistakes and become a good Developer.


r/javahelp • • Oct 04 '21

What are the most common Java mistakes Senior Developers notice from Juniors/Beginners? And what are some good practices everyone should know?

68 Upvotes

Hi. I'm learning Java and trying to improve my skills everyday but I just wanted to hear this from some devs about Junior or beginner devs. I'm sure that there is a lot of common mistakes and a lot of good practices you would recommend but I'm just asking the ones that come to your mind immediately. Thank you.


r/javahelp • • Apr 17 '25

Took a Java position after 5 years without working in Java

65 Upvotes

I dropped Java with Version 8 in Production. My last Java commit was in 2020.

What's the version that is usually being used nowadays in Prod?

Is IntelliJ still the most popular IDE for Java?

Has people move from Maven to Gradle finally or it's still common to find Maven projects out there?

Is still Spring Boot taking mins to load your application?

Is Mockito still the dominant library for mocking in Java?

Any recent library people started to use more often?

Any comment you have? I'm coming from Golang, but honestly I wasn't able to get used to that language and I wanted to change jobs, so I took a Java position back again. I'm very excited because this is the language I always loved.


r/javahelp • • Nov 13 '20

So I know how to code in Java, and I'm really comfortable with it. But, how do I actually create a usable application, outside of the IDE?

65 Upvotes

I've been coding for several months now, and I've acquired a lot of knowledge throughout the way. I've coded many applications, but I never really wrapped one up in order for it to be ready for user execution. I've only tested them in the debugger or in their GUIs, but I don't know how to save user configuration or how to make an application that is ready for use. How do I do that?


r/javahelp • • Jul 30 '24

Homework I'm doing 'Call of Duty' using Java.... I need help!!!

57 Upvotes

I'm in college and our professor left us a project and it's about recreating a popular video game by implementing data structures and algorithms. Here's the thing, we have to make 'Call of Duty: Black Ops', obviously it won't be the exact game.

My classmates and I want to base it on 'Space Invaders', but you know, change the spaceships for soldiers. Among the requirements is to use Java only, so we have had problems trying to find useful information, but we have not found anything relevant so far.

Does anyone know how the hell I can make soldiers using pixels? It should be noted that we do not have much experience using Java, maybe 4 months... In any case, any recommendation is super valuable to me.

Thank you!!


r/javahelp • • Aug 14 '21

Codeless Any Java dev or people learning Java looking for a mentor for their careers?

56 Upvotes

Mods if this isn’t fit for this sub just let me know and I’ll remove (apologies if so)

Hi everyone,

Long time Reddit lurker here. So I’ve been toying with something I get asked a lot in real life which is to do some mentoring.

Firstly let’s be up front this is completely free I just want to give back to some communities which helped me build my career.

To give some some info on me:

I’ve been working in tech for 23 years.

  • I’m the CTO of a scale up

  • I’ve sat on the board of a multinational IPO’d company for the last 3 years

  • I’ve been the head of engineering at another company for the 4 years

  • I’ve held various other managers roles Including head of automation, devOps, performance.

  • before all that I was a dev and principal engineer.

I won’t lie I’m not wonderful at Java but I love this community, I used to dev in C,C#, Python and I’ve never been part of a community as the Java one.

What I’m offering here is mentoring on growing your careers and that type of thing. Absolutely we can talk code too if that’s what you want but outside of general best principles there will be better people to ask 😂 I’m too far removed from the code for too long at this point.

if people are honestly interested comment below or DM me. I’ll most likely open a slack channel or a discord for us all to talk.

Thanks for reading and hope to hear from you all.


r/javahelp • • Oct 14 '19

What are the projects in java that made you a much better programmer?

51 Upvotes

I have been coding in Java for a while now and I am at a loss of what to create to get better. I want to know the projects that were most effective that have made you better at coding in java.


r/javahelp • • Sep 30 '20

I am studying Java 7/8 in my University. Am I loosing time since current Java version is 15? Are 7/8 versions too old or still valid? If they are still valid, for how much time will they be until they become deprecated?

50 Upvotes

I am studying Java 7/8 in my University. Am I loosing time since current Java version is 15? Are 7/8 versions too old or still valid? If they are still valid, for how much time will they be until they become deprecated?


r/javahelp • • Jul 19 '26

Should I use Gradle or Maven in 2026?

49 Upvotes

There are a lot of answers but everything I found is from 2021-ish times. Things I got from there is "Maven is slower, more verbose and for that reason - way more stable." and "Gradle is faster because of the daemon and more customizable, but hot garbage when it comes to update, shit breaks and build.gradle(.kts) is spaghetti in big projects". For Maven, I don't think much changed because of their philosophy (and I'd say that's good), but what about Gradle? Is it still that bad when it comes to updates and deprecations?


r/javahelp • • Mar 19 '22

REMINDER: This subreddit explicitly forbids asking for or giving solutions!

49 Upvotes

As per our Rule #5 we explicitly forbid asking for or giving solutions!

We are not a "do my assignment" service.

We firmly believe in the "teach a person to fish" philosophy instead of "feeding the fish".

We help, we guide, but we never, under absolutely no circumstances, solve.

We also do not allow plain assignment posting without the slightest effort to solve the assignments. Such content will be removed without further ado. You have to show what you have tried and ask specific questions where you are stuck.

Violations of this rule will lead to a temporary ban of a week for first offence, further violations will result in a permanent and irrevocable ban.


r/javahelp • • Feb 20 '26

How to get better at Java?

48 Upvotes

I have been working as a software dev for 5 years now and have predominantly worked with Java but I feel like I haven’t really become an expert in this and still find myself making mistakes from a best practice perspective and wouldn’t consider myself at a senior level yet technically. Is there anything I can do in my own time to improve my professional Java practice? I am not sure what the best way is, I can read books but I am not sure if that’s the most effective way to do so?


r/javahelp • • Nov 04 '19

Why is String capitalised, but int, float, boolean etc are not?

48 Upvotes

Is it because it's a reference type? If so, are all reference types in that format and all primitive types are lower case?


r/javahelp • • Nov 15 '20

Is there any benefit to having multiple import statements instead of something like "import java.util.*"?

45 Upvotes

For instance, if I am only using the Scanner class from the java.util package, is there any benefit from using
import java.util.Scanner;
instead of
import java.util.*;?

or
import java.io.IOException;
import java.io.File;
versus
import java.io.*;

I guess a better question would be: does import java.util.*; import everything from java.util, or does it only import what's necessary to make the code execute properly?


r/javahelp • • Jan 30 '19

Learning java while blind

45 Upvotes

Hay everyone as the title suggests I am blind and trying to learn java. I was just wondering if anyone had any experience, knolage or perhaps even knows one of the very illusive blind devs. If so I would realy appreciate any help you could offer.


r/javahelp • • Mar 04 '20

Codeless Can dumb people learn java programming ? Asking for myself :)

43 Upvotes

I am a very slow learner and consider myself dumb when it comes to programming. Can I learn and probably master java on my own ?


r/javahelp • • Sep 14 '24

I just upgraded from Java 8 to Java 11 in one step

42 Upvotes

I just cheered like a little child and want to share it with someone. I need to maintain a ~ 15 year old project with about 100k LoC. Today I tried what happens when I update it to Java 11.

And literally nothing happened. Everything compiles, all tests run.

I feel like a child on Christmas Eve.