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 bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.

learn more… | top users | synonyms (2)

-1
votes
0answers
16 views

Converting roman numerals to arabic numerals

I went to go hand in my computer science lab today on the day after it was assigned. We have 10 days to complete this lab. My teacher stopped me and said that there was no way I finished this quickly. ...
0
votes
1answer
15 views

Checking whether number is in given range

Introduction I want to check whether number is in given range. Function takes: long number that should be checked 2 longs threshold values byte range mode Range mode is represented as number of ...
-4
votes
0answers
23 views

What is the best/Optimal way to refactor multiple for loop? [on hold]

Here is my code which is going to through multiple for loops to get the matching product attribute. I have single product with attributes trying to find out the ...
1
vote
1answer
51 views

Splitting strings in Java

I wrote a function which takes in input a list of strings that is splitted by comma. Then each generated string is trimmed. Example: ...
-1
votes
0answers
18 views

how to refactor multiple for loops? [on hold]

Note: Please do not use any String functions. No sorting allowed. No additional arrays or data structures allowed. An array is said to be hollow if it contains 3 or more zeros in the middle that are ...
0
votes
0answers
21 views

BFS in a grid with wall breaking saldo in Java

In this problem, we are given a 2-dimentional grid, with each cell being walkable or holding a wall. Given an integer \$s \geq 0\$, find the shortest path from the source node to target node breaking ...
7
votes
5answers
990 views

Counting number of eights

I was doing a few basic Java recursion problems to refresh my memory with recursion (honestly never had to use it in a long, LONG, time), along with using it as a useful way to prepare for any ...
-3
votes
0answers
30 views
3
votes
2answers
31 views

Finding the keys of map with the highest values (equality may occur)

I am currently implementing a Poker game, I have created all the logic for getting the rank of a hand, and I now have to determine the winner of a given hand. Due to this being Poker, there may be ...
-5
votes
0answers
21 views

Design and code a program that will calculate the following: [on hold]

Design and code a program that will calculate the following: a markup amount (the amount you will increase the selling price (i.e., the cost to make a doll times the markup percentage) a selling ...
2
votes
1answer
104 views

Roman numerals to Arabic number

Is there any way to make this for loop more concise or efficient? I fell like there should be a way that you can cahnge the for loop so that it is about half the size that it is know. By the way, the ...
2
votes
1answer
32 views

Java - Log4j Singleton

First time on this community board. I'm trying to design and develop a singleton class that will handle resolution and configuration of log4j (not log4j2). The basic idea is to have a single class, ...
-4
votes
0answers
19 views

math.pow programmed manually [on hold]

Hi I am trying to program math.pow manually. This is my work so far, but eclipse returns when I run it. Any kind of review is welcome. Thanks in advance ...
0
votes
0answers
21 views

Java class 'SymmetricEncryption': Caesar Cipher, ROT13, Vigenere

I had to do the following exercise: Write a class 'Symmetric Encryption' which has methods for the following encryption techniques: Caesar Cipher ROT13 (Simplified) Vigenere Cipher The precise ...
5
votes
2answers
58 views

Checking whether the max and min values occur equally frequently

An array is defined to be "maxmin equal" if it contains at least two different elements and the number of times the maximum value occur is the same as the number of times the minimum value occur. So {...
4
votes
1answer
66 views

Assembly Line Scheduling challenge, solved using TDD

I am new to Test Driven Development and currently practicing it with some problem statement. Following is an Assembly Line Problem statement I solved using TDD approach in java. Please provide me some ...
2
votes
0answers
20 views

Concurrent ObjectPool using ConcurrentLinkedQueue

Main ObjectPool Class: It uses atomic operations and a concurrent linked queue to achieve the best performance compared to Apache commons pool. I want to make sure there are no concurrency issues even ...
-5
votes
0answers
17 views

“Merchants Guide to Galaxy” challenge [on hold]

RomanValidator Link for Merchants Guide to Galaxy Challenge Program For converting Roman Numeral to Numbers, 1) if currentchar > previouschar currentchar-previouschar ...
-5
votes
0answers
20 views
1
vote
3answers
35 views

Extract subarray of elements that appear after the last occurrence of “4”

I am doing some challenges, and in one challenge given a non-empty array of int, I am to return a new array containing the elements from the original array that ...
1
vote
4answers
66 views

Java class to compute and get a MD5 hash as a string

Here is my class file to compute MD5 hashes on a file. I wanted to be able to easily calculate them without having to create a lot of overhead in the code using the class. Can anyone tell me a list ...
-3
votes
0answers
17 views

Two player Java Conentration (Memory) Game [on hold]

So I'm creating the game, its just instead of using one action listener for all the buttons, I am using multiple ones for each individual button. This is a two player game, I am having trouble keeping ...
-1
votes
0answers
22 views

Java Naive Bayes Sentiment Analysis [on hold]

I am trying to implement Java version of the PHP code of Naive Bayes Classifier Here's the Github link of PHP version. For some reason, the Java code is classifying Positive sentiments as Neutral one'...
1
vote
0answers
26 views

Snaplogic Script to group key-value pairs based on a certain ID field

Following is the script I'm using to group key-value pairs based on an ID field viz. interface_id: ...
6
votes
1answer
73 views

Java Singly Linked List

Here is a naive version of a singly linked list in Java. It implements only Collection and Iterable interfaces. Any comments and ...
-1
votes
0answers
13 views

Can't parse date correctly from edittext in android [on hold]

I'm trying to parse a date from an EditText in android, to convert to another date format, but I can't get the correct day. This is my code: ...
6
votes
2answers
56 views

Printing mutual anagrams

Question: An anagram is a word that can be written as a permutation of the characters of another word, like "dirty room" and "dormitory"(ignore spaces). However, "the" and "thee" are not ...
1
vote
0answers
27 views

Beginning of any maximum ascending slice of an array A of maximum size

I want to write a function public int solution(int[] A) that, given a zero indexed array A consisting of ...
0
votes
0answers
18 views

Permission manager to verify permissions in jersey endpoint

In my system I have users with quite a lot of different permissions. For my Jersey REST endpoints I need to check for some of those permissions for example the admin permission. Then if a user did not ...
0
votes
0answers
44 views

Serialize data into one byte array using ByteBuffer

I have a class in which I am passing certain parameters through the constructor and then using those parameters to make one final byte array with a proper format (header + data): ...
5
votes
3answers
71 views

Colored image will become black and white

For a project of mine, which is targeting java 6, I had been in the need to have different algorithms/methods to change a BufferdImage with a ...
2
votes
1answer
74 views

Adding various types of configurable validators to fields

I am currently reworking our entity code generator, that uses JaxB for schema validation, and Stringtemplate for code generation. As we are giving our professional service the possibility to add ...
4
votes
0answers
58 views

Dynamically creating login screen on Android devices

This has been an experience. I'm well above "hello world" java is not a language I use often when programming and I don't program too much. I find myself a lot on Google.... basically just about for ...
0
votes
0answers
33 views

How can I efficiently remove a line of information from each file without rewriting the file? [closed]

The main class handles all of the universal objects : ...
-3
votes
0answers
40 views

UnitTesting retrofit network call

I am testing the sync network call via Retrofit. I wonder whether the test below is good enough to determine if a call was successful or not? As I have never written a test before, I also wonder ...
2
votes
2answers
45 views

Object to return user specified generic types in backend code

The idea is that a user will dynamically edit simple key/value settings that will customize their instance of the application, e.g. the welcome banner text. I am trying to implement everything in a ...
-4
votes
0answers
24 views

Please help me on creating a Bingo Card Generator in Eclipse IDE [closed]

*The problem right now is that I need to create a Bingo Card Generator Application in Java. All I have so far is the Bingo class: ...
-4
votes
0answers
19 views

basic java hangman game [closed]

ok I'm teaching myself java. so naturally I'm confusing myself with a lot of things. can someone tell me how to make this program keep track of letters that were already used and print out that the ...
0
votes
1answer
106 views

Round Robin implementation in java

I tried to implement round robin in java please check and help me to improve it Thanks: ...
-1
votes
0answers
25 views

Libgdx/Java - How to find the distance between multiple objects in an array [closed]

So I'm currently working on a game where multiple meteors spawn and you have to avoid them. The problem is the meteors sometimes spawn overlapping each other, which I don't want. I want them to spawn ...
2
votes
2answers
62 views

Java class for sorting arrays based upon QuickSort algorithm

Hint: This question is a follow-up to my Code Review question from 09.01.2017: Class sort with BubbleSort algorithm After been showed Mergesort and QuickSort as pseudo-code this week in lecture ...
-1
votes
0answers
18 views

stack Push& pop [closed]

import java.util.Scanner; import java.util.Stack; public class Stack_Ex2 { ...
2
votes
1answer
80 views

Java Swing Calculator

I've been learning java for over a year and I'm looking for better ways to learn and I'm trying to get a better idea of where I am as a programmer. I honestly have no clue if my code is good or bad. I'...
3
votes
0answers
46 views

Boilerplate for spring-boot with spring-loaded

Since many Java web projects use Spring, I created my own boilerplate to quickly create a new spring project. I had to fix something that I didn't understand but it worked. Is it redundant and there ...
4
votes
0answers
57 views

Multi-threaded code to handle messages from a provider

Having a look at my code, is there a way to be losing elements? ...
0
votes
0answers
31 views

Queue that permits at most X simultaneous operations

I ran into this once (permits=N) and then again today (permits =1) where I only want 1 to N operations running simultaneously. One example comes from firing into a state machine (the permit=1 example)...
2
votes
1answer
76 views

Generate the alphabet and select only specific letters

I am learning java and would like to create a very simple application but which uses SOLID principles. The required functionality is: generate the alphabet with a possibility to select specific ...
2
votes
1answer
53 views

Filtering out the correct car from a list of cars and retrieving only one car

I am filtering out a List<Car> based on the brand. Since each car is made by one brand, I want to make sure my method ...
3
votes
0answers
14 views

Symmetric decryption with javax.crypto

I'm trying to determine if this code could be a memory hog with huge files. Can anyone tell me if there is anything I can do to make this more memory efficient, or is this how java.crypto works? <...
1
vote
1answer
26 views

2 Queens on N x N board

I am trying to write an algorithm to solve a variation of the N queens problem. There are only 2 queens on an N x N board. I simply need to find the number of solutions, don't need to know what the ...