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
1answer
25 views

Java Brainfuck Interpreter Method

Due to the fact that nobody's ever posted this before (sarcasm) I've made a brainfuck interpreter in java. The interpreter fits in a single method, and is designed to be readable, fast, and concise, ...
0
votes
2answers
28 views

Random Password Generator in Java

I made a random password generator in Java using a GUI. In the program, the user can choose the length, and whether to include lowercase letters, uppercase letters, symbols or numbers in the password. ...
0
votes
1answer
22 views

Java Scanner String input [on hold]

I am doing Java exercises from HackerRank.com and bit confused about this problem. Here is my code that pass the test case. ...
2
votes
0answers
14 views

Prim's MST Java implementation

Can someone review this code, just have look if it's logically correct or If you may point me to a more simple and minimalist program ...
0
votes
0answers
11 views

Libgdx play class becoming overwhelmingly complex/messy

I came here today to see if I could get some pointers to cleaning up some code for my game. I started developing this game, and now the class seems to have gotten way to big. It's the play screen ...
0
votes
1answer
45 views

DIY String Encryption

I was asked to make a String encryption utility without using encryption API. I basically had to come up with my own encryption methodology! the program was to be able to encrypt a string and decrypt ...
1
vote
0answers
17 views

SQLite database for books

First, my Book object: ...
-1
votes
0answers
8 views
-1
votes
0answers
11 views

Java 8 lambdas and streams Map to constrained Map [on hold]

I have a Map with 1000 keys, which have Integer 'fitness' values ...
1
vote
1answer
26 views

Alternative to using Object and casting in a map

I have the following class which represents a set of properties. ...
2
votes
2answers
39 views

Concatenate unlimited amount of arrays with predefined function

I am working on learning more about arrays and loops! I have been trying to create a method which will allow me to take for example an unlimited amount of arrays and append or concatenate them to each ...
-2
votes
1answer
39 views

How to efficiently perform calculation in do while loop? [on hold]

I am trying to do some calculations in do while loop, there are no errors but it is just taking lots and lots of time. Basically I have got an array that contains 240 strings, there are 20+ radio ...
4
votes
2answers
42 views

Postfix calculator

As part of my learning Java I'm doing various tasks I set myself - one such task is a postfix calculator. It seems to work with all tests I've given it, and I would really appreciate some review of ...
2
votes
1answer
47 views

Data structure linked arrays

This is a hyperid implementation of a linked list and ArrayList: The total capacity is divided into \$\sqrt{n} \text{ "arrays count"} \sqrt{n} \text{ "array ...
0
votes
1answer
34 views

Admin and Client “is a” user

First of all, I'd want to represent, in my application, two different users (admin and client) which can access to two different classes, through two different graphic interfaces... My idea is to ...
4
votes
0answers
32 views

Wrapper for Java logging

I am currently working on a new version of my application, and I just finished rebuilding the log part. It works well but I am skeptical about the choices I made. I am a student and I work alone in ...
0
votes
0answers
7 views

JAVA: Confused why jTextArea wont append correctly [on hold]

i have a textarea that displays select results from an external mySQL database. I want to keep it updated for any new inserts so have set a timer to repeat the query every second. In my code the ...
3
votes
1answer
24 views

Places and their PlaceCategories

I'm going to start small here because I actually have several questions but I'll go one at a time. In the app I am making to better learn Java/Android/SQL/OOP, I have a page where a user can define ...
0
votes
2answers
43 views

Basic Array based stack in java

Here is an array based stack. I tried to implement this basic stack from memory. I want to make sure it is correct. ...
0
votes
1answer
36 views

Logging errors and debug messages

I'm currently working on a small project that uses Java to handle a socket-based MMO browser game. I'm still at the beginning of the project and I'm currently writing a class that logs errors and ...
0
votes
1answer
25 views

Highlight Two Closest Points Java Swing

Question from the book: (Geometry: closest pair of points) Write a program that lets the user click on the panel to dynamically create points. Initially, the panel is empty. When a panel has two or ...
2
votes
2answers
61 views

Simple Input Text Analysis

I've started learning java. I've written a small program I've done in C before. It's simple input analysis. If there is number, program checks if number is prime. Then write number: (value of input ...
8
votes
4answers
2k views

Simulate a printer

I'm trying to recreate a printer in java,I'm fairly new to programming so I'm using huge if else blocks inside a single function to dictate the logic of the program, I'm noticing this is creating a ...
1
vote
0answers
32 views

Calculating costs with several objects

could you please help me to improve this code? I have a feeling that it is doing too much inside the method. How can I split it to smaller functional blocks? ...
0
votes
1answer
32 views

Class that holds calculation results and has to be immutable

I'm roughly trying to follow the guidelines in "Effective Java", "Item 15: Minimize mutability", hence the class is not "final" on purpose. Information is gathered from a number of temperature ...
6
votes
2answers
570 views

Yet another lexical analyser

The following program is a lexical analyser for a simple and small grammar. Please read my code and answer me these questions: Is my code easy to understand? Is my code well organized? Are there ...
1
vote
0answers
32 views

Storing large maps in memory

Context of the problem: I have a very large graph that cost about 4GB to store. About 3M nodes and 34M edges. My program takes this large graph and recursively builds smaller graphs from it. At each ...
1
vote
1answer
46 views

Bubble sort in Java

I have implemented simple BubbleSort algorithm. How can I optimize my code? Any suggestion would be helpful. ...
-4
votes
0answers
11 views

How to Update all fragments? onProgressUpdate Does not update all fragments [on hold]

I'm basically getting a value updated inside an AsyncTask and I use onPostExecute to send it to the fragments. All the fragments ...
1
vote
2answers
51 views

Multithreaded brute force prime generator

A number is a prime when it is divisible by 1 and the number itself. To check if a given number is a prime we can divide the number by primes which are less than the square root of that number. If ...
4
votes
3answers
65 views

Finding b and e such that b to the power of e is closest to a given number

The question is to find a number with absolute minimum difference from a number of the form be. I came up with the below code which takes 4 seconds to solve each test case on an average however it has ...
1
vote
1answer
24 views

Counting standard deviation from parsed XML file

I wrote a method that calculates the average and standard deviation of sell currency exchange-course (ASK). But I think that it isn't the easiest way to define such behavior. In my opinion there is ...
2
votes
3answers
140 views

Programming challenge “Greatest Odd Divisor”

I am trying to solve a programming problem on a coding platform. When I submit the code on the coding platform, it throws a "Time Limit Exceeded" error. Can someone check my solution and help optimize ...
2
votes
2answers
112 views

String Encryption

I was asked to make a String encryption utility without using encryption API I basically had to come up with my own ecryption methodology! the program was to be able to encrypt a string and decrypt a ...
0
votes
0answers
18 views
-3
votes
0answers
52 views

Stuck with class design in Java, Solution is too hard to maintain

I'm working on an important project, we're a IT services provider and we have a project where we have to build a new system to process data from a specific client. The problem is, that usually we ...
5
votes
1answer
28 views

Obtaining all repeated characters' position in a string using Java Stream API

Input is a string, and the method should return repeated characters in that string and the position of these characters. I'm currently using Java 8 Stream. The problem is I have to do it by calling 2 ...
0
votes
1answer
50 views

SQL message logger run loop

I am learning Java by reading source code of other authors. This Java method handles communication with SQL database. While the code does work several things concern me. For instance the ...
1
vote
1answer
75 views

Program to calculate a student's test average

I made a very simple program where you input a students grades (edit the code with the set method?) and the program will output the average. Each test has a different weight associated with it. The ...
2
votes
1answer
62 views

Create a unique four digit code from 35 characters

I want to generate a four digit code based on the code generated before it, starting at 0000 and going to zzzz. These are the available characters to be inside the code: ...
4
votes
0answers
39 views

Project Euler #54 in Java: Comparing poker hands of two players

I was bored the other day and decided to have a crack at Project Euler Problem 54 for some fun. Given a file containing one thousand poker hands dealt to two players, the task is to count the number ...
3
votes
1answer
43 views

Code to merge sorted linked lists in java

Since I am using Hackerrank codepair, I have to resort to inner classes. Please review the code and let me know if this can be improved. ...
1
vote
0answers
34 views

POJO-based PDF form filler

I'm pretty new to Java development and have written a little POJO to "PDF Form Filler" program. I'd be interested in recommendations and suggestions about coding style, used methods and classes and so ...
1
vote
1answer
47 views

Pattern searching in 2d grid

This is an interview question which i am trying to solve. You are given a 2D array of characters and a character pattern. WAP to find if pattern is present in 2D array. Pattern can be in any way (all ...
1
vote
0answers
24 views

Hde keyboard when pressing outside EditText

I am using the following method to hide the keyboard when the user touches outside edit text. I am passing most top view into my method ...
3
votes
3answers
93 views

Age Distance Calculator

Here is my final build of the Age Distance Calculator - Any feedback on the code would be great - This is my 2nd day of java programming and thought this was a good little project. ...
3
votes
1answer
89 views

Tracks the number of calories consumed throughout the day

Tracks the number of calories a person consumes in a given meal it has helper method to get the day's total. The check method Tries to find any duplicate meals within the given list. The assumption is ...
-1
votes
0answers
25 views

Java - How do i break my program after an If error message? [closed]

As you can see from the title I have my main class that follows the set commands of AgeCalc ac = new AgeCalc(); My question is at the if statement to disallow users typing a number less then theirs in ...
1
vote
0answers
14 views

Wikipath stack in Java - Part II/IV - The implicit Wikipedia article graph

This question is the continuation of the Wikipath stack series: the two classes that - given a Wikipedia article \$A\$ - return the lists of neighbour articles. The forward node expander return the ...
4
votes
2answers
54 views

Find Intervals with Most Overlaps

Given a list of time intervals, I want to return the intervals with the most overlaps (i.e. most people free). My solution runs in \$O(n \log n)\$, but I made a bunch of "tracker" variables. How can I ...