Skip to content

Tag: arrays

Why do Min & Max show up as 0 in my array?

Why do Min & Max show up as 0 in this array? I tried to figure it out for a while now but I couldn’t wrap my head around it. Here is the ‘min’. And the ‘max’ I am not sure what the issue is. ||SOLVED|| Changed min and max and also added maximum(x); minimum(x); in main while r…

How to count the number of elements in one input

I hope you can help me with my task. I have tried to research different sites for this, but can’t find the specific one. Let us say that I’ve input 3, 2, 1, 5, 6 then the output should be 5. Another example is I have inputted 1, 2, 3, 4, 5, 6 then the output should be 6. It

Loop Object from a single Array

im sending a Json Array from Activity A to Activity B, and i want to populate that Json Array into Spinner in Activity B. but when i Log the json array from Activity A, the data becomes a single object “NVAKSINATOR” : [{“NVAKSINATOR”:”[{“NVAKSINATOR”:”20800&#824…

What’s the difference between these 2 array definitions?

What us the difference between int[][] a = new int[2][3] and int a[][] = new int[][]{{11,12},{13,14,15}}? I decompiled the .class file and found in the first case, the JVM will use multianwearray to create the array, while in the second case, it will use anewarray. I think in the first case, JVM will create a…

Big Decimal array not sorting 0 and 000.000

I was solving a java HackerRank problem in which I had to sort an array consisting decimal numbers using BigDecimal class in descending order. The solution works fine except for one case in which 0 and 000.000 comes. Now as they are equal, the problem tells us not keep them in the same order of their occurren…