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)

4
votes
0answers
15 views

Process multiple files - save the words, count and position in each file

I am trying to create an index for searching a word in multiple files. I am trying to save the each word with count and position along with file name. So far I am using a ...
2
votes
0answers
14 views

Class structure to handle API exchange

I'm developing a simple application that crawls web pages to obtain some information. For this I used and tested some libraries, like crawler4j, jsoup, jaunt and htmlunit. I change the crawler APIs ...
1
vote
1answer
29 views

Calculating unknown parts of a right triangle

I am in the process of creating a program that allows a user to input known parts of a right triangle and the calculates all of the unknown parts if it is possible. I am using a class that I wrote in ...
2
votes
3answers
39 views

Calculating a payment price based on a selected phone

The program shows three phones with prices, and you need to select one of them. The program will then calculate the price based on the payment type you selected. I'm very new to the world of OOP, and ...
-1
votes
0answers
45 views

Hardcoded Mail-Based File manipulator

I am developing a small application in Java where I receive a text file and based on the type of the file received, different operations are performed on it for eg: Split into multiple files, Merge ...
2
votes
2answers
51 views

Convert a start and end date chosen by a user to epoch

This method allows the user to choose a start and end date in human readable form, then convert it to epoch. The method will return a array of longs composed by the ...
4
votes
1answer
123 views

Starting and stopping a thread for a command handler

I built an application class that should be runnable as a Thread and it would be nice to hear opinions of Java developers to improve my coding style. ...
5
votes
1answer
40 views

Simple JavaFX Calculator

Good day everyone, I made a simple JavaFX calculator. It does basic calculations, and works to the best of my knowledge. However, I'm a novice at both Java and JavaFX, so I seriously doubt this is as ...
-1
votes
0answers
14 views

JTextArea trouble [on hold]

I am making a poker game and I have hit an issue, almost everything works up to the deal button's actionListener. It is supposed to remove the deal button and add a new JTextArea (this text is just a ...
1
vote
0answers
23 views

Purging elements from the map if it reaches a memory size limit

I have implemented a LRU cache using ConcurrentLinkedHashMap. In the same map, I am purging events if my map reaches a particular limit as shown below. I have a ...
-2
votes
0answers
11 views

My arbitrary-precision number library (decimal, binary, and rational) [on hold]

I've written a library for implementing decimal, binary, and rational numbers in arbitrary precision (which is in C# and in Java). I'd like review on any aspect of the code, particularly the API, as ...
2
votes
2answers
49 views

Counting the occurrences of a string in each file

I am trying to find a phrase or a string in file and count the number of occurrences of that string: ...
1
vote
0answers
17 views

Understanding lazy sequence in Clojure

In order to understand how the lazy sequences work in Clojure, I decided to implement the quick-sort example from the "The Joy of Clojure, Second Edition" book simulating lazy sequences in Java. Of ...
2
votes
1answer
31 views

Making use of Events in Java Swing and scaling shapes

I have this project that should respond to events. Can my code can be refactored and become shorter? Am I using actionListener properly? ...
8
votes
3answers
431 views

Integer quicksort in Java

I have this Quicksort implementation that sorts arrays of int (not Integer). It has comparable performance to Java's ...
-1
votes
0answers
25 views

Truth table calculator in java [on hold]

I am trying to make a truth table calculator in java. I am running into 2 problems. When I use a not statement (p|!q) the code shuts down. If I have 2 bracketed items ((a&b)|(c&d)) it gives ...
-1
votes
0answers
12 views

AdvancedRTFEditorKit Quaqmire [on hold]

I'm using AdvancedRTFEditorKit, but have had trouble saving all formatting (Bold, Italic, Underline, & Alignment). After making some tweaks (as shown below), I've gotten it to work just fine but ...
15
votes
0answers
94 views

Golf some Code with A-Ray

For some of those in The 2nd Monitor, you know that I was creating a new golfing language. For one or two (@Quill), you have heard from me how tough it is. A-Ray (that's what it's called) is a ...
-4
votes
0answers
28 views

How to construct an array for each keyword that stored in ArrayList? [on hold]

this is my task: for each keyword construct an array where each cell stores 1) a pointer j from set L*(w) = pseudorandom [L(w)] and 2) semi private item v  this is my semi private item, v ...
-3
votes
2answers
42 views
3
votes
2answers
69 views

Converting money into change

I am trying to figure out a more efficient way of converting money into change. The code below is what i have written so far. It works perfectly but i know the code can be improved. Is there a more ...
7
votes
5answers
656 views

Finding the number of vowels in a string

I'm new to Java and is trying to solve the beginners problem of finding out the number of vowels in a string. I was just wondering if there is any alternatives to any of the steps that can improve ...
8
votes
2answers
276 views

Bridge, We've Got a Problemo

Now that we can move across the bridge, it's time to finally set up the problem so that it can be solved. A reminder of what the assignment is: Welcome to the Bridge Crossing Problem. Person Pn ...
4
votes
0answers
48 views
+50

BouncyCastle implementation with X509Certificate signing, KeyStore generation, and Socket creation

The following is a (somewhat messy) implementation of the BouncyCastle cryptography library. I create a self-signed certificate (hopefully correctly), store it in a Java KeyStore, and use it to create ...
4
votes
4answers
82 views

Soundex algorithm implementation in Java

Just started learning Java Strings. Tried to implement the Soundex algorithm. Package to hold the String related functions ...
3
votes
2answers
47 views

Conditional logic to determine if popup menu should be visible

I have this small piece of code written in a class. I am looking for a nicer way to write this, preferably avoiding nested if statements like what I currently have: ...
5
votes
1answer
48 views

Build all possible phrase pairs from a sentence pair

I have an array for an English sentence (enSentence) and for a German sentence (deSentence). Each value represents one word. I ...
4
votes
2answers
91 views

Given a path to a directory, print the path to the biggest file in it

Here is my code. I simulated a stack rather than used some regular recursive algorithm because I needed to keep track of two variables: the path to the biggest file and its size. Besides I wrote a few ...
5
votes
1answer
65 views

Displaying a randomly sized array as a table

This program creates an integer array with a random size of 5-50 elements (inclusive). It then fills the array with random numbers between 0 - 100 (inclusive). The interesting part comes when I then ...
6
votes
1answer
101 views

Quadratic function solver + testing

I wrote a simple quadratic function solver with unit tests. Can anyone check if this is okay? Quadratic function class ...
1
vote
0answers
44 views

Restarting properly

I have an activity with a timer in it, which starts an activity when the timer goes down. Before, when onPause() would get called after a phone call, my activity ...
1
vote
1answer
36 views

Google Maps coordinations JSON to object

I am trying to write a parser from JSON data which I get from Google requesting coordinates of a city, which will create my specified object structure. For parsing, I've written a custom ...
6
votes
2answers
95 views

Moving across my (sturdier?) Bridge

Building on top of the classes in this question of mine, I've made this class to support the moving of the entities for my given assignment: Welcome to the Bridge Crossing Problem. Person Pn can ...
-6
votes
0answers
42 views

Working 2048 Game with Java code with a few bugs [closed]

I recently made a basic 2048 game without scores, death, or victory yet. Can you guys also tell me other things that can improve my game? Controller Class: ...
4
votes
2answers
49 views

Binary search traversal with in/pre/post order and BFS/DFS

I have the following code for the BST for the inorder, postorder, preorder, breadth first and depth first traversals. Can you review and let me know the optimisation points and issues, if any? ...
5
votes
2answers
165 views

Custom sorting of dates

I have implemented a class which implements a list of my custom DateObj. I have sorted the list in a peculiar manner based on the current month. I achieved my ...
-4
votes
0answers
14 views

Code for cards and finding probability [closed]

this program is supposed to find the probability of a another player having pockets pairs (Ex: 8 of Diamonds and 8 of Hearts) given that one player already has a pair in hand. I had both the Cards ...
4
votes
1answer
32 views

Reading entire contents of file at a given java.no.file.Path into a String

What I'm wanting to do is create a String readFile(Path filePath, Charset encoding) method, that returns the entire contents of a given file. I'm wanting the ...
5
votes
3answers
90 views

Simple Java task scheduler

The task is pretty simple: implement a timer that executes tasks when the next event takes place. I created a task scheduler based on a priority queue. A new thread is created for ...
3
votes
1answer
34 views

Extracting various URL parameters in Rest Service and then passing it to Builder class

I have a service which takes a lot of key value parameters in a URL. Only a few are mandatory and others are optional. It's up to the customer whether they want to set those optional parameters or ...
0
votes
0answers
36 views

Making record of students and their grades [closed]

I am trying to write the following code which enables the user to enter a student's details (username, firstname, surname) as well their grades (there can be one grade or several). The code can also ...
0
votes
1answer
55 views

Printing odd and even numbers with two threads

I would like to refactor this code printing odd and even numbers with two threads considering agile practice: ...
0
votes
1answer
106 views

Hex-to-octal converter

The code converts hexadecimal into octal. The function is working, but it takes more than a second to process the input. How can I optimized this? ...
2
votes
1answer
40 views

Convert Multivalued map to HashMap

I have a Multivalued map (javax.ws.rs.core.MultivaluedMap<String, String>) which I want to convert to regular HashMap so I got below code: ...
7
votes
4answers
147 views

First text-based number-guessing game

This was a learning experience. I have looked around and found some better ways to write some things but wanted a second opinion to look at what I've written and kind of analyze it as well. I just ...
-1
votes
1answer
53 views

Custom currency format

I have the following code for currency formatting ...
-1
votes
0answers
21 views

If you were asked to modify the WebServer code to use the RMI Server, which part(s) of the WebServer source code would create problems? [closed]

We are working with a web server. Web server makes use of 4 data tables to store some information, and these tables are currently in the form of Java data structures (3 maps and 1 list). There is also ...
3
votes
3answers
413 views

An integer is even subset of another integer

An integer m is defined to be an even subset of another integer n if every even factor of m ...
-1
votes
0answers
35 views

HAL HATEOAS library for java

This library allows you to serialize pojos in the HAL specification format. Review of the code as well as the guide and documentation is appreciated. ...
2
votes
2answers
84 views

Java rolling dice + csv array output

I have made a program to take x number of die and rolls them y number of times, then stores the data into an array so that I may output a CSV file. Everything works as intended, but I am having ...