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
7 views

Finance Manager

Somewhat experienced with javafx, but this is my first potentially large javafx project that I recently started and wanted some feedback on anything that could be done better or more efficiently thus ...
0
votes
1answer
14 views

String hash generator

There is a lot of code duplication because it generates hashes using multiple cryptographic hash algorithms. How can I improve this code? ...
2
votes
3answers
45 views

First n primes optimization

Pretty standard. Generates the first n primes, input via a scanner. ...
1
vote
1answer
60 views

How to keep game code organized

What are the best practices to writing clean, expandable game code? I always end up getting overwhelmed with my games because the code gets very unorderly. I use OOP (java), but I still feel like my ...
5
votes
1answer
46 views

Generating a sequence of MAC addresses

The following code will generate a sequence of N mac addresses based on the input from user. The input must be atleast one octet to generate the sequence , ie : ...
1
vote
0answers
37 views

REST web service to interface with a customer database

In what ways could I improve this? Does it look good? Any security concerns? I am using Jersey, Jackson and JPA. What about the architecture? I basically have ...
2
votes
1answer
21 views

pdftk replacement

I am working on a replacement for a program called pdftk. The program needs to be able to take pdf's, and generate fdf files for them, fill a pdf from an fdf, output info about the forms, and output ...
2
votes
1answer
39 views

Counting all substrings with exactly k distinct characters

Problem Statement : Given a string of lowercase alphabets, count all possible substrings (not necessarily distinct) that has exactly k distinct characters. Example: Input: abc, k = 2 Output: 2 ...
4
votes
2answers
30 views

Finding an equilibrium index in an int array

Here is a programming challenge from codility A zero-indexed array A consisting of N integers is given. An equilibrium index of this array is any integer P such that 0 ≤ P < N and the sum ...
0
votes
1answer
32 views

ANDing ints in Java [on hold]

Is there any better way than doing: if ((newState & InputState.DEFAULT) == InputState.DEFAULT) ? My InputState.class defines static int variables to the ...
0
votes
1answer
34 views

Base N To Decimal Converter

Problem Implement a base N to base 10 (decimal) converter, where N is between 2 and 36 inclusive. Implementation Am I over-complicating things in ...
6
votes
1answer
84 views

Beginnings of a Chess game

I'm pretty new to programming (haven't written much code myself, only read code for my computer science studies etc) and I keep getting confused by how to best structure my code. Let me get a bit ...
4
votes
0answers
34 views

Asynchronous task execution using actor based concurrency

I have a program where I need to implement asynchronous tasks (writing a directory to a file following any change to the directory). There is existing documentation within my organization for ...
-3
votes
0answers
24 views

Java stream: filter collection by contingently primary key of an object [on hold]

I have object Event, the field name of it considered to be unique. I would like to return object by name. ...
-8
votes
1answer
33 views

Printing the results of many cryptographic hashes [on hold]

Which of the following Java code would run faster? ...
2
votes
0answers
21 views

Swing keybinding to control an animated car

In my textbook there is no mention of keybindings and it encourages the use of keylistener so there isn't any example code using keybindings for its problems. I was wondering if this is sorta close to ...
5
votes
2answers
75 views

Pool volume estimator

I am looking to make the following code more efficient since it it rather lengthy. However I need to include in the code constructor classes that include accessor methods for the container number, ...
-1
votes
0answers
21 views

Java: trying to extend an interface implementation [on hold]

I'm working on a school project and I want to extend ArrayStack. ArrayStack is an implementation of the interface StackADT. I'm creating DropoutStack as an extension which I want to be exactly the ...
2
votes
2answers
86 views

HackerRank: Equal Stacks

This is my solution to the Equal Stacks problem on HackerRank. I thinks it's really messy and slow. could you give me some thoughts about how to optimize given code and algorithm(i'm pretty sure ...
1
vote
0answers
21 views

Correcting time in DST gap using Joda Time

We have a class which acts as a time interval, containing a LocalDate and two counts of minutes since midnight. One of the methods on this class converts these values into two DateTimes. Since ...
3
votes
2answers
58 views

Array-based queue implementation

Here I have implemented a queue. Is this a correct, efficient queue implementation? what issues are there if any and what can be done to make it better? ...
-2
votes
1answer
52 views

Should I Check for null color? [on hold]

I have the next piece of code which changes the colors of some buttons. ...
-2
votes
1answer
70 views

Decorator pattern using Java 8 [on hold]

Wikipedia has an example of a decorator pattern here: https://en.wikipedia.org/wiki/Decorator_pattern#Second_example_.28coffee_making_scenario.29 I was trying to solve this using functional style ...
2
votes
3answers
45 views

Optimizing Java SHA-512 String-to-Hash Generator

In an attempt to learn Java and SHA-2 I created a very simple String-to-SHA512 generator. Here is the code: ...
3
votes
3answers
50 views

Acronym Generation

Problem Implement a relatively naive acronym generation. I was trying to implement a solution without using regex. Portable Network Graphics => ...
8
votes
2answers
75 views

Rainfall challenge: how big are the basins?

August 2016 challenge The Rainfall Challenge Problem description is copied verbatim from the linked Code Review question: Problem Statement A group of farmers has some ...
-1
votes
0answers
43 views

Where can my code break in the following scenario [on hold]

I have the following JSON: ...
0
votes
0answers
18 views

Real Coded Genetic algorithm performance issue [on hold]

I am pretty new to genetic algorithms, and wrote a real valued genetic algorithm with an sbc function used for crossover. Currently I was trying to use the class below to train the weights for ...
2
votes
1answer
39 views

Validations in filter class

For my web application I have written AuthenticationFilter which validates each request to check against CSRF attacks, Browser Checks, Session Validity etc. Instead ...
-1
votes
0answers
26 views

if else cascading replacement [on hold]

I am developing a simple java program which is run from command prompt using the JAR that I built. My program involves a lot of if conditions. My scenario is like, ...
6
votes
1answer
38 views

Count how many times a value is referenced in a grid

I've got list of points: List<Point> seedPoints. Each Point contains x and ...
4
votes
1answer
80 views

A simple MP3 file arranger

I am creating a simple Mp3 Files Arranger the Project is on Github Questions: How can I optimize this app? Am I violating any OOP principle? Is it readable? How can I make it better? GUI.java <...
0
votes
1answer
36 views

HackerRank's Project Euler #10: Summation of Prime

Task- to find sum of all primes not greater than N Input format- first line contains T, the number of test cases and second line N Constraints- 1<=N<=10^6 I used the Sieve of Erastothenes. ...
0
votes
1answer
24 views

Project Euler 29 logic [on hold]

I just finished Project Euler #29. And it worked successfully. But after comparing my answers to those from other folks, i realize my answer is wrong. Now it seemed to give me the correct example when ...
0
votes
0answers
19 views

Project Euler #29 [closed]

I just finished Project Euler #29. And it worked successfully. But after comparing my answers to those from other folks, i realize my answer is wrong. Now it seemed to give me the correct example when ...
2
votes
3answers
261 views

Simple Chaining Implementation of HashMap

I'm practicing writing my own simple version of a Java HashMap. I don't have much experience with generics in Java. ...
2
votes
2answers
152 views

Print numbers in a concentric square pattern

I am trying to solve a programming problem on a coding platform. When I execute it on my PC, it works perfectly, but when I submit the code on the coding platform, it throws a "Time Limit Exceeded" ...
4
votes
1answer
56 views

“Similar Destinations” challenge

I am currently solving the Similar Destinations challenge on HackerRank and am in need of some assistance in the code optimization/performance department. The task is to take a list of up to 1000 ...
4
votes
1answer
47 views

Programming challenge “Friend Request in Social Network”

I am trying to solve a programming problem on a coding platform. When I execute it on my PC, it works perfectly, but when I submit the code on the coding platform, it throws a "Time Limit Exceeded" ...
2
votes
1answer
21 views

Image-processing filters using decorator pattern in Java

This is a follow-up question of this other one, where I was trying to use the Decorator Pattern in a Python example. I figured, that Java might be a better language for this exercise, so I ported my ...
-1
votes
0answers
20 views

Morse Code Translator in a GUI [closed]

I made a morse code translator with a GUI which I made in eclipse's WindowBuilder. It works, but I feel like things are very wrong, because things don't show up until I click in it or hover over where ...
-2
votes
0answers
23 views

Asynchronous DB data retrieval and asynchronously posting it to Queue using RxJava [closed]

I am testing an operation where I read data from DB and sent it asynchronously while I also post the received data to a Queue asynchronously using RxJava. I have ...
4
votes
2answers
72 views

Add numbers in array without adding adjacent number

This is first time I code reviewing and would like feedback on coding in industry standards and optimum code. This program adds number in array in two formats: Adds adjacent numbers in a serial ...
-2
votes
0answers
21 views

How do you compute the size of the tree at any given depth? [closed]

It should be the case that for any given k. The number of nodes in the tree, at exactly depth k include node n if depth(n) == k. This is what I have so far but its not passing my tests: ...
4
votes
0answers
24 views

SVNKit - Speed up diff on large repositories

I have large amounts of sometimes massive Subversion repositories I'm trying to scan to find the number of additions, deletions, and files changed, similar to what GitHub does. Because of this, the ...
6
votes
3answers
74 views

Table printing code using a fluent interface

Let's say you want to display something like: One Two Three Four 1 2 3 4 And since you hate the idea of predefining the widths of the columns you ...
1
vote
0answers
33 views

Releasing references with server connection library

I work on a custom library (Co.line) to do HTTP requests in REST. I tried to think of reducing the memory usage by cancelling the thread background and destroying all references. It uses a ...
-3
votes
0answers
22 views

Find largest sublist by particular criteria [closed]

I'm struggling with quite interesting assignment and looking for advise. The case is to find the largest sublist from the given set of pairs. First elements from these pairs should be in ascending ...
4
votes
2answers
82 views

Merge sorting a singly-linked list in Java - follow-up

In this iteration, I incorporated all but one points made by forsvarir in the previous iteration. Now my code looks like this: LinkedListNode.java: ...
2
votes
3answers
67 views

Java number formatting in accountant style

I have written a string number formatter. I would like to know if this can be improved and any suggestions with how it's done. The purpose of this function is to convert a double that has been ...