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)

-3
votes
0answers
12 views

Project Euler Problem 21 - Amicable Numbers - JAVA [on hold]

Help Debugging please. Program won't stop. ...
0
votes
0answers
14 views

Deeper understanding of Android AppWidgets [on hold]

I recently developed my first appwidget for Android, and it works really nice. I basically created a collection widget and use a Loader to retrieve the data from a database, and when a user clicks on ...
4
votes
1answer
23 views

Sieve of Eratosthenes with a Swing UI

I'm fairly new to Java. I want to divide my code into 3 classes. First class to contain my GUI, second to compute the algorithm and third class to write results in my file. I have the code working but ...
3
votes
2answers
63 views

Poisonous Plants

I have solved the following problem. My code works but Hackerrank says that I can do faster: There are plants in a garden. Each of these plants has been added with some amount of pesticide. ...
-5
votes
0answers
24 views

Reusable code snippet to start activity [on hold]

We all do startActivity() to start new activity from anywhere. Now how good practice it is to have ActivityUtils and that has ...
-2
votes
1answer
37 views

Return whether there are 2numbers or 3 numbers in an array that add up to specific given sum [on hold]

Need to find 2 numbers or 3 numbers from an array of integers. I have methods for both. I am not sure if this is the best approach to do so. ...
-4
votes
0answers
17 views

connect same attribute in another classes in java [on hold]

I have some problem here and I don't know where is it in code here there are 3 classes and many attributes actually in class Registration there are uniqueStudentID same in class Student and courseCode ...
7
votes
2answers
316 views

Validate whether a ransom note can be made from a dictionary of words

For simplicity, it is checking whether the characters in a string (that needs to be created) are present in a larger string (dictionary). Would a character array of the letters make sense here, or ...
2
votes
1answer
32 views

Extending functionality of org.springframework.batch.item.file.transform.DefaultFieldSet

I would like to be able to set token values (defaultFieldSet.tokens) and names (defaultFieldSet.names) on ...
0
votes
1answer
69 views

Producer-Consumer issue in a multi-threaded Java environment [on hold]

The scenario which I'm trying to implement: This class tests the Worker class. It invokes the run() method of a Worker instance....
2
votes
1answer
46 views

Tight coupling in using call back method

I am using below code and for result i am using interface for call back purposes. ...
3
votes
2answers
57 views

Finding the frequency of an element in a sorted list of integers

1> Input: Array of sorted integers and an element to check the frequency for. 2> Output: Frequency of the element ...
2
votes
2answers
50 views

Finding the Least Common Ancestor of a Binary Tree

Input a binary tree (the root node) and 2 other nodes that need to be assessed for finding the least common ancestor (LCA) Code: a. Finding the nodes first with either ...
1
vote
1answer
42 views

Multithreaded Producer-Consumer pattern

I have Producer Threads A, B and C producing 3 different types of events Events A, B and C respectively. The Consumer thread can ...
2
votes
1answer
63 views

Iterative solution for generating all permutations of a string

I know the runtime for generating all permutations is supposed to be \$O(n!)\$. I'm not sure if the code I wrote for it runs in \$O(n!)\$ though. I'm having trouble analyzing its runtime. The ...
1
vote
0answers
73 views

Code that checks input for calculator app

I made an Android app, a calculator, that uses buttons for input, Android keyboard is turned off. I have a block of code, that handles the input to string and checks for some things at the same time. ...
2
votes
1answer
64 views

Connect Four in Java for two human players

Connect Four kinda caught my eye, and I decided to start from the very basics. Here I have bare-bones implementation for playing the game between two human players on the command line: Board.java <...
-5
votes
0answers
41 views
3
votes
1answer
39 views

Writing a byte array image to disk with an automatically generated filename

I have the following code that that writes large images to disk. My application server is running out of memory and I'm wondering if I could somehow optimize the following: ...
5
votes
2answers
138 views

Unexpected Low FPS while drawing images

I am in the process of making a game, and during this endeavour, I have come across problems maintaining a good frames per second while drawing my sprites. When I draw my background image, my frames ...
0
votes
0answers
14 views

The same object as parameter of function and returned [on hold]

I write the question for my fellow worker (I want to send him a link with the question and answers). I would like to ask you about arguments you have that the code below is bad. It is purely C++ code ...
3
votes
3answers
69 views

Optimizing time and space complexity of recursive solution on string manipulation

Given a string, compute recursively a new string where all the lowercase 'x' chars have been moved to the end of the string. ...
2
votes
2answers
49 views

Circular Singly Linked List using Java

Please review my implementation of Circular Singly Linked List ...
5
votes
2answers
36 views

Search files from large directory and sub-directories

Essentially I have a large directory with many sub-folders and different formats of files. It reads through XML, JAVA, .txt, etc, in search of a selected String inputted by the user. The results ...
-4
votes
0answers
14 views

Improper Output [on hold]

So this is a problem i have been working on for ProjectEuler #7 where the objective is to find the 10001st prime number... My code returns the number which comes just after the required output ...
2
votes
1answer
43 views

Standard Test methods for checking values in Lists, Maps etc

I needed to check the values in various Lists and Maps. In my case, the various types of Objects that needed checking were of four types: String ...
3
votes
1answer
28 views

Unit tests for custom Map wrapper

A while ago I asked for a code review of my automatically keyed map and I have recently had the time to get around to writing some unit tests for it using JUnit4. The test ensures that all of the "...
-1
votes
0answers
23 views

Rock Paper Scissors game that simulates one random play and one consistent player [on hold]

This is my homework for my CS101 class, I'm not looking for an exact answer, just some guidance please! The program is supposed to simulate Rock Paper Scissors where one player chooses completely at ...
4
votes
2answers
49 views

Flood-clearing routine for a JavaFx Minesweeper

I really hate copy and pasting my code from one method to another. It signals something in my brain, "This could be done either more efficiently or more readable". This is used in a minesweeper ...
-1
votes
1answer
47 views

Searching into a contact list

I am performing search in a contact list using linear search with complexity \$O(n)\$. Please suggest me how to improve search strategy in my code. ...
1
vote
2answers
38 views

Create a calendar application to check the scheduling conflicts of meetings

The purpose here is to find if there is a conflict in the given set of start and end times of the meeting time slots listed. Input: Start and end times of meetings Output: True / False for conflicts <...
0
votes
0answers
10 views

Python api for an existing Java API [closed]

I am new to python and I have to design a Python API(version - 2.7) similar to an existing Java API Python version - 2.7 The Java API is as follows There is a Process interface ...
2
votes
3answers
48 views

Sorting a list by the modulus of 3

The input is an unsorted array of integers. The output should be an array of integers sorted based on the modulus of 3 (or any other number). It begins with all integers conforming to Integer % 3 == ...
2
votes
2answers
53 views

Print max occurring character in a String

This prints the character that occurs the most in a given string. Input: String of word(s) Output: Max occurring character ...
0
votes
0answers
33 views

How memory-efficient is my sorting algorithm? [closed]

I'm wondering how space inefficient the algorithm I created is, (I know why), and how that makes an algorithm like this obsolete compared to RadixSort. If I had thought of a way to make this more ...
6
votes
5answers
250 views

A custom String Builder implementation

Two code files below : the actual logic & the test logic. Core Logic ...
3
votes
3answers
79 views

Checking if numbers in array are sorted or reverse sorted

I would like to determine is an array of numbers, is always increasing (for all x, x+1 >= x) or always decreasing (for all x, x+1 =< x). If so return true. Another way to state the problem is, ...
1
vote
1answer
25 views

A simple Insertion Sort implementation in Java

I've written a InsertionSort algorithm in Java and I want a review on these: Performance improvements. Code conventions. Algorithm design improvements. Cleaner approaches. I would highly ...
3
votes
3answers
46 views

A simple bubble sort implementation in Java

I've written a Bubble Sort algorithm in Java and I want a review on these: Performance improvements. Code conventions. Algorithm design improvements. Cleaner approaches. I would highly appreciate ...
-2
votes
0answers
23 views

Guess number games [closed]

While loops How do I get the program to read the code once the while loop has been proven true? My program is asking if the user would like to play again but then terminates the program without allow ...
-5
votes
1answer
31 views

Is there a way that I can omit an empty catch block [closed]

I'm posting this because I have a catch block in my code that is useful to me in catching an exception, but does not do anything further with it. In other words, I don't want the program execution to ...
-3
votes
0answers
23 views

Java: Prime Number Search [closed]

I am very new to java and I was trying to create a simple program that finds the amount of prime numbers less than or equal to a certain integer that is inputted by the user. this is the code ...
7
votes
1answer
63 views

Calculate loan rate based on payment and duration in months

So I have the following code which works well-ish. Looking for ideas on how to improve it. ...
4
votes
2answers
49 views

Simulating a random packet routing algorithm and printing packet statistics in Java

I have this short program for simulating a random packet routing algorithm: Packet.java ...
3
votes
2answers
28 views

Program that organizes files based on folder name and file name

I am rather new to coding, and I would like to see what improvements should I make to the code I wrote to ensure that I am using good practices, and that it will function as it's supposed to. The ...
-2
votes
0answers
37 views

Evaluation of SOAP and REST based code for Expressitivity

Currently I am doing a project for my Master's thesis and have to evaluate web service standards for Web of Things applications(Real-time Patient Monitoring System). Below is code I have written in ...
6
votes
1answer
53 views

Scrabble tile-counting challenge

While reviewing this Scrabble Tile Counter, I decided to give it a try myself. Here is the challenge, from Reddit's /r/dailyprogrammer: Description For this challenge we will be using the ...
7
votes
2answers
68 views

Database credentials and connector including encryption

I'm designing a small Java desktop application to interact with my database and this is a very important part of it as a majority of the operations will be involving the SQL Server 2012 database. I am ...
3
votes
0answers
38 views

SQLite Databse inserting + Unit tests in Java

Genereal Introduction This is my first project which involves a Database which involves testing (especially unit testing) where the quality is really important for me. The long term aim is to ...
2
votes
1answer
93 views

Reading Input from file for sorting and rewriting

I am writing a program that reads a DAT file with names. The names are stored in an ArrayList of Type Name, the Name object can hold the first, middle and last name. Once the names are stored in the ...