Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to byte-code and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.

learn more… | top users | synonyms (2)

0
votes
0answers
20 views

Function which finds the sum of factors from one to N

After optimizing my function which I plan to use in Project Euler 95, I've run into a wall concerning further improvements. This code is destined for my library of project Euler functions, so while ...
3
votes
0answers
15 views

Wavefront-Reader (.obj) in Java - Part 1

I want to implement a wavefront-reader in Java. Therefore I've created some classes to extract a Vector3f, Vector2f (i use JOML for these model classes) or a Triangle (my own model class) from a ...
2
votes
1answer
16 views

Scalability when the number of calls increases

In one of my object I needed a sequence I would use to increment an Id field just like we often do with classical Databases. As I have not found a suitable solution, I wrote one. In the following we ...
5
votes
2answers
51 views

Every node in binary tree = sum of subtree

I wrote this in Java (I know that the brackets don't exactly follow the standard way of doing it in Java - so it looks a bit like C#). But I was wondering how this algorithm is percieved. I have seen ...
1
vote
0answers
25 views

Threadsafe webapplication getParameter()

I am new to Web Applications and Thread Safety. Please, could somebody tell me if the following example is thread-safe? My main concern is that the AClient and ...
0
votes
0answers
45 views

Hanoi tower in Java [on hold]

Here is the code: ...
3
votes
1answer
42 views

Prim's minimal spanning algorithm

Is there a way to speed up this code so it is \$O(n^2)\$ instead of \$O(n^3)\$? I'd appreciate if someone showed me how to do so. ...
-3
votes
0answers
8 views

App has stopped working after adding parse notification module [on hold]

here is the code,one of my activities.my app works fine but when i add parse module in app..its works fine but shows the error app has stopped working at background ..app works fine ..no error during ...
-2
votes
0answers
37 views

Prompting the user for a product number and quantity

Write a Java application that prompts the user for pairs of inputs of a product number (1,2,3,4,5) and quantity of units sold (any integer)? Use a ...
2
votes
1answer
44 views

HackerRank Regex Challenge: Detect HTML Tags

Problem Statement In this problem you will use regular expressions to help you detect the various Tags used in an HTML document. Here are a few examples of tags: The "p" tag for ...
3
votes
3answers
65 views

Linked list implementation - follow-up

Follow-up to this question as recommended. Can this code be improved from an OOP paradigm perspective? ...
3
votes
1answer
35 views

Randomly learning a neuron to act as a signal counter

I have this small program for learning an artificial neuron to act as a simple signal counter: my cell has four input wires (also called dendrites) and a single output wire (also called axon). If at ...
-2
votes
0answers
12 views

Euclidean Distance For CSV file of 4 column [on hold]

I have an issue with calculating euclidean distance for csv file of 4 col, the algorithm should produce matrix but the bellow algorithm does not: ...
1
vote
1answer
63 views

OOP paradigm implementation of a linked list

Can this code be improved from an OOP paradigm perspective? ...
3
votes
2answers
76 views

Checking if an element sastifying a condition in a list comes before another of a different condition

This is for Java 6 and uses Guava. It's a little ugly and I'm worried I missed some obvious way to do it a lot better. If there is more than one element satisfying either condition I am saying it's ...
2
votes
0answers
32 views

Printing a binary tree in vertical strips

I'm trying to print a binary tree in vertical strips. For instance, a tree like this: 8 / \ 6 10 / \ / \ 4 7 9 12 / \ 3 5 ...
0
votes
0answers
11 views

Android Zoomable Listview

I spent a day looking for a Zoomable ListView and every answer was broken in some way. Finally I found a great template and made a couple changes to handle scroll boundaries. You can extend any view ...
1
vote
0answers
27 views

Heap selection sort - follow-up

See the previous and initial iteration. I got rid of Run objects and just maintain two integer arrays in the RunHeap: one for ...
2
votes
3answers
71 views

Bubble, selection, and insertion sorting

The following programs are bubble sorting, selection sorting and insertion sorting. As most of the programs online or in books are with Arrays and not ...
4
votes
1answer
44 views

Java 8 find array of countup sums

I have an array of some arbitrary int values; I want to find the array containing the sum of the past elements in the current index. Example: ...
7
votes
4answers
975 views

Simple beginner Java calculator

This is my first calculator in Java. I just started learning a week ago so any feedback (positive and negative) is welcome. Tell me what's good and what I can improve on. ...
7
votes
3answers
67 views

Checking whether an array contains all distinct values

This method returns true if any arrays element is equal to another element value, returns False otherwise. ...
2
votes
0answers
13 views

GUI for Selenium web testing

I am wanting to build web-based testing tools for test website environments utilizing the Selenium Web Driver. I am building a GUI which will contain the following: Drop-down for selecting the ...
7
votes
5answers
341 views

CodeEval Challenge: Remove specified characters from a string

Question Write a program which removes specific characters from a string. The first argument is a path to a file. The file contains the source strings and the characters that need to be ...
-1
votes
0answers
19 views

In my application, we need to read some value from the properties file [on hold]

In my application, we need to read some value from the properties file. Util.properties key1=value1 key2=value2 I have written a new class to read ...
0
votes
0answers
18 views

In my application, we need to read some value from the properties file [on hold]

In my application, we need to read some value from the properties file. Util.properties key1=value1 key2=value2 I have written a new class to read ...
4
votes
1answer
108 views

Class for modifying stats of units

I am specifically looking for input on naming ModifierCalculator and Modifiers. I would also appreciate input on whether ...
4
votes
1answer
63 views

Matching strings

Basically I solved this question on one of the competitive websites: Given the total n number of String on first input, n input follows: We have to find such pairs of string (i,j) such that ...
2
votes
1answer
43 views

OpenGL ES 2.0 Sprite rendering

Is this a good method to render sprites (textured quads) or is there a faster or better way? Example use: ...
1
vote
1answer
19 views

Alert dialog manger class

I want to make a general alert dialog to use across the whole app. I created a class called AlertDialogManager and just one method to show ...
-3
votes
0answers
25 views

Can I shorten my Mexican Wave implementation? [closed]

This code is for solving the Code Golf problem: The Mexican Wave. I take an array of chars, and print it out 26 times, for each iteration I capitalize the ...
6
votes
2answers
145 views

Address book in Java

I've been learning Java for a month now using programmingbydoing.com in addition with reading the Java reference. I've had very very basic programming experience and I'm trying to improve my skills. ...
3
votes
0answers
47 views

Sorting colors by the name of the color

I was in need to sort Colors, so the first thing that I tried was this: ...
2
votes
1answer
21 views

Swap items of a linked list in pairs - revision 3

Here is the source of the question. Revision 1. Revision 2. When I started the second round of code review, I wanted to make sure that I had included all the possible input types. However, I ...
0
votes
0answers
15 views

Android bitmap modification and rendering app

I have an Android app that is laid out like this: The first fragment is a textureView that simple renders a CameraPreview. ...
3
votes
1answer
42 views

Priority stack in Java

I have this (simple) data structure that maintains multiple LIFO stacks. Each such stack is assigned a priority. The less is the value of a priority key, the higher the priority. Pushing operation ...
3
votes
0answers
26 views

Calculatraining with FX

There have been a lot of calculators lately. It seems like this community challenge all over again, I didn't make a proper one then, so I'm joining the calculatrain now. Going off from the lessons ...
-1
votes
0answers
23 views

how can I do method return values instead of method voids? [closed]

Develop a program that reads up to 52 double values of weekly rainfall for a given city. The program then uses a method to input less than 52 values and returns the number entered, with the following ...
5
votes
2answers
136 views

Logging/debugging for testing purposes

This is basically a logger which I use/wrote. It has convenient features like including one-line stack traces with print statements, making the text easier to find, and piping all output to either ...
5
votes
1answer
58 views

Combine a set of “ranges” to find least number of ranges

Given a set of ranges with lower bound and upper bound, I need to combine these ranges to produce minimum number of ranges which will cover all the values in the original set and nothing else. ...
4
votes
1answer
26 views

Method for downloading a PDF from a website in Android

How is this? Any ways to improve? ...
6
votes
1answer
48 views

“Heat spot” image generation using bilinear interpolation

This is the code from my answer to a another CR question. My goal was to provide a fast and simple computation and I'm rather unsatisfied with it. It's maybe 10 times faster than the original, but ...
-1
votes
0answers
20 views

Displaying an integer's separate digits using while/loops [closed]

I am trying to figure out how to display any integer's digits from first to last on separate lines using while loops. So far, I only know how to display a designated integers digits (three digit, four ...
-2
votes
0answers
20 views

Java - JPanel gets 10px taller [closed]

I have a class that extends JPanel. It consists of a JTabbedPane with JPanels that have ...
2
votes
2answers
57 views

Heap's algorithm - integer permutation

Integer permutation using Heap's algorithm: ...
0
votes
0answers
24 views

RNG in Java being evenly distributed [closed]

We all know that RNG's aren't perfect. However, I found this test particularly interesting: Basically what I have is a simple program that computes the frequency of numbers in a standard dice roll in ...
3
votes
2answers
52 views

BigDecimal wrapper that ignores zero operands

I want to perform mathematical operations on a range of values, where zeros should be ignored. This means that multiplication by zero does not result in zero but returns the first operand and likewise ...
3
votes
3answers
134 views

Finding number of palindrome pairs in an array

I am trying to find the number of string pairs in an array that are palindromes. ...
5
votes
3answers
117 views

Finding k largest (or smallest) elements in an array

I have written this code for the question: Finding k largest (or smallest) elements in an array My approach uses a temporary array. Please suggest any ...
0
votes
0answers
39 views

Optimising nested for loops Java [closed]

I am having a code that does scheduling of a days events based on the exact fit basis. I am kind of having three nested for loops and I'd love to hear thoughts on ...