Tagged Questions
Java is a general-purpose programming language designed to be used in conjunction with Java Virtual Machine (JVM). "Java platform" is the name for computing systems that have installed tools for developing and running Java programs. Use this tag for questions referring to Java programming language ...
0
votes
0answers
12 views
How to conver (cast) double[] to byte[] in Java?
I want to encode double[] with Base64 or similar. For this I need to have byte[] how to convert/represent/cast double array to byte array with minimal copying?
I was considering to use ByteBuffer and ...
0
votes
0answers
4 views
Java swingworker output
I have some code running in a swingworker, because it might cause the UI to block, I would like to revise the UI with the progress of the swingworker thread so I am using publish/process to revise a ...
0
votes
0answers
3 views
Android Development: Repository (AVD) for Genymobile
I'm new to Android Development.. I've installed everything necessary to my knowledge. I tried installing Genymobile (AVD), and followed the steps, but when I put the link ...
0
votes
0answers
11 views
Questions regarding mysql and java
I'm stuck on a couple of problems, and i've tried googlein, but to no sucsess.. i'm a starter in android development, and i've decided to make a pretty big app but useless, this is only training.
...
0
votes
0answers
4 views
Constructing map with parent child relation in java to get d3.js json tree format
Hi I am reading the csv which contains the parent and child relation of data. I am struggling to make map which contains parent child relation of CSV data .Below pic is the given CSV Data through ...
0
votes
0answers
21 views
Java Dealing 5 random cards showing how many cards are left in deck
I posted yesterday about this assignment and you guys helped me a lot! I have been able to get my program working and I cleaned it up (I think). I just have one last thing to do and I'm honestly not ...
0
votes
0answers
19 views
How to check the arguments sent to method is taken in order
heart method of mockCenter, which is mocked object of Center class, takes arguments, as shown below, in order. I want to test that the called method heart is actually taking the arguments in order. ...
-5
votes
0answers
31 views
Need Java Eclipse [on hold]
I would like to install Eclipse into my laptop and all other possible files, so that I can use Eclipse without any issues.
Someone have trusted source where I can download Eclipse along with its ...
0
votes
2answers
41 views
Verify if a String is an integer (numberFormatException)
I was trying to write a piece of code to test if a string contains an integer. I am aware of the try catch solution, but i have read it becomes bad if you call the method from other classes. What I ...
0
votes
0answers
7 views
cplex java api ifThen structure
I am trying to model an constraint in cplex which is of IF-THEN structure. In a 2d-array(m x m+n) i want if the sum_ofRows(m rows) is 1, then the sum_ofColumns(m columns) should be 0 . In cplex java ...
0
votes
1answer
9 views
Guice dependency injection choosing one of two implementations based on configuration
I have two implementations of my service interface,
public interface Service {
public ServiceResponse get();
}
One being a Mock implementation which returns a stubbed ServiceResponse and the ...
0
votes
0answers
14 views
How do I Test a Web Service that throws a SQLException
I have a web service class...
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.annotation.Resource;
import ...
0
votes
0answers
10 views
Java and Node.js server code treated differently by firewall?
I have made 3 different types of extremely simple servers on a remote port:
Java TCP Server
Java HTTP Server
Node.js Server
I tested each separately, connecting them to the same port (call this ...
-6
votes
0answers
17 views
Can I please get an example of how to use the Card Layout with JPanels in different classes [on hold]
Can I please get an example of how to use the Card Layout with JPanels in different classes. The simplest example you can give me
-2
votes
0answers
8 views
I get java errors in my application that is about Direct Move (Pump it up) for Android. Am i doing anything wrong?
I get a lot of errors when running my application. I need your help to figure out what went wrong with my application.
0
votes
1answer
14 views
How can I set the components of my JFrame to be organized neatly instead of jammed together?
My credit card program uses JFrames and all the Panel/Text/Label stuff and I am having trouble with understanding Layouts. How can I modify the components of my Jframe/label to make them look ...
0
votes
1answer
29 views
How to populate an arrayList with data collected through an object. (android)
I am currently working on this problem in which I have to collect several data from input fields and save this as one instance in a list. So the idea is when I enter the data then click on the save ...
0
votes
1answer
52 views
Setter / getter method inheritance
So I was studying about inheritance in java and I didn't get it quite clear. Suppose we have a parent method with a private variable and public setter getter methods. A subclass inherits these methods ...
0
votes
1answer
11 views
JButton is only appearing on MouseEnter
JButton is only appearing on MouseEnter
I've tried multiple things but I can't seem to figure out how to get my JButton over the background graphics. . Does anybody know how I can paint over this ...
0
votes
1answer
14 views
How to recursive the authomata Strange Planet exercise?
The basic idea of this is that in a planet there is three diferent kinds of species, only two of the three species can came together to procreate, and the result is that this to species die a two new ...
-2
votes
0answers
18 views
Comparing objects in an array list for sign in [duplicate]
I'm trying to create a method to validate and compare a username and password against User objects stored in an array list but it seems to be letting anyone log on successfully. It's like it isn't ...
0
votes
0answers
8 views
Storing and retrieving user uploaded images in parse
I have successfully been able to store user entered information into parse, but I haven't figure out how to do store a user uploaded image that would be associated with the current user in parse, and ...
0
votes
2answers
11 views
SimpleAdapter with two different colored custom row
I have used two different colored custom row. But it returns the same row which is black. I have a yellow row too, but it return only a black one. I couldnt understant it, thus I have shared my source ...
-4
votes
1answer
26 views
What can be the possible test cases?
I was given the following question in a programming test but i cannot seem to understand why it could't clear all the test cases. What possible test cases am I missing?
A credit card company charges ...
0
votes
1answer
35 views
Get pixel color in java
I know this is an expensive operation and I already tried to use the robot.getPixelColor() function but it works slow, can only calculate like 5 times in a second.
What I'm saying is that 5 times is ...
0
votes
1answer
7 views
Android - Change color of multiple choice listview background
I have a multiple choice ListView which defaults as having a white background but when selected, the background of the item changes to blue (defined here by a hex code).
mItemState = new ...
0
votes
0answers
18 views
Setting TextView throws nullPointerException
LogCat keeps giving me a null pointer exception. Issue started when I tried to display "Numbers" in my TextView (tview3).
Here is my code:
@Override
public View getView(int position, View ...
-1
votes
2answers
28 views
Why button is showing error of declaring variable final
Below is my code , as I want it when I click on button the function is call from jni and show the output on the screen , below is my code :
public void onCreate(Bundle savedInstanceState)
{
...
-9
votes
2answers
44 views
Java Calculator programming NumberFormatException's
I am trying to make a calculator in Java. I have made much progress so far, but when the equal button is pressed when I try to do a calculation in the calculator, nothing happens and error messages ...
0
votes
2answers
35 views
Confusing “converts an array of numeric characters to an int value” behavior
"converts an array of numeric characters to an int value."
Here is the code:
public static int parseInt(char[] a){
int result=0;
for(int i=0;i<a.length;i++){
...
0
votes
0answers
7 views
HTTP Status 404 - /BilalWebtier/WEB-INF/jsp/loginParam.jsp
package controller;
import java.io.IOException;
import java.security.Principal;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import ...
0
votes
2answers
25 views
Null Pointer Exception in Layout
I found Null Pointer Exception in my Layout file.
I am using ViewPager for whatever reason I found NullPointerException.
Following is xml code for layout.
<?xml version="1.0" ...
0
votes
1answer
41 views
Recursive method that changes a character from a string
I am trying to create a method changes the char, at position p, to char "c" from a string "s". It needs to be recursive and I am not allowed to use any other method from the class String, other than ...
0
votes
0answers
14 views
Spring data Neo4j: nested exception is java.lang.NoSuchMethodError
when i am trying to deploy my application, using Spring data Neo4j, i get following exception.
Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: ...
-1
votes
2answers
32 views
How to create a folder in java
So, I want to create a file in a folder on the desktop. But I don't want everyone who downloads the game to have to create that folder. Is there a way to do this? The did for the folder is:
...
-3
votes
0answers
37 views
Open List<String> of websites [on hold]
I have been trying to open some websites that are stored as a List.
I can't seem to get this to work:
List<String> url = getConfig().getStringList("url");
String open = url.toString();
try {
...
0
votes
2answers
26 views
How to map an object stream to a specific type
I have a JSONArray of objects, and I want to map each object to a JSONObject.
I tried:
JSONArray array; //my json array
array.stream().map(obj -> (JSONObject) obj).forEach((JSONObject prof) -> ...
0
votes
1answer
20 views
Adjusting Shunting Yard Algorithm to accommodate absence of whitespace
How can I adjust the code below to accommodate no whitespace between digits and operators? For example, infix: 2 + 2 postfix: 2 2 + but infix: 2+2 postfix: 2+2.
I am new to Java and did not write ...
-1
votes
2answers
20 views
Error Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0 at Src.main(Src.java:6)
i am using this program and getting the above error!
public class Src {
public static void main(String args[]) {
// TODO Auto-generated method stub
int ...
-1
votes
1answer
33 views
Can't read data from a file in java
Here is the problem I want to solve https://www.codeeval.com/open_challenges/100/
and here is my solution:
public static void main(String[] args) {
// TODO code application
File file = null;
...
0
votes
0answers
10 views
Change PircBot Login
Is it possible (through some hack/cheat/legitimate way) to change the login name used with PircBot? To be clear, I'm not talking about the nickname, I'm talking about the login name, sometimes called ...
0
votes
0answers
17 views
Different results when running app in debug and normal mode
I am developing an application that needs to record some audio from the MIC and make some DSP with it.
The audio captured is stored in a WAV file and being plotted afterwards from this file.
The ...
-8
votes
1answer
50 views
I need help writing game of life [on hold]
This is what I have to work with from my teacher but I'm trying to figure out how to initialize a new game. I am just asking for a hint because I've been trying to figure out what I'm suppose to do ...
0
votes
0answers
10 views
Gradle 2.0 generates ivy.xml seemingly by default
I currently trying out gradle and am using the java plugin.
However every time I build, I find that the ivy.xml is getting generated as well.
I have not included any other plugin such as the ...
0
votes
2answers
35 views
How to access all the different instances of an objects variable separately?
I am generating 100 ovals as particles in the initialization method and then I want to move them by a certain amount(lets say x) for n number of iterations. I have written the following code snippet ...
0
votes
0answers
9 views
How to reinstall the appcompatv7_11 package in android?
So, I had to have my laptop restored, and now when I open my eclipse workspace, my appcompat_v7_11 package has an error in it, and now some of my apps have errors all over the place because of it. I ...
1
vote
3answers
29 views
Fixed-size collection that keeps top (N) values in Java
I need to keep top N(< 1000) integers while trying to add values from a big list of integers(around a million sized lazy list). I want to be try adding values to a collection but that needs to keep ...
0
votes
1answer
11 views
How to retroactively make a java app fit different screens
I have a fairly large (6000 lines) java application with over 40 buttons etc. and fixed window size.
This is creating problem for people who wants to use it for some it is too small for others it is ...
0
votes
1answer
13 views
How to position my buttons?
Okay so I have this code in FXML and I want the four bottom buttons to be all directly next to each other and stuff but I can't figure out how to position them at all using CSS.
Can someone tell me ...
0
votes
1answer
19 views
How to open the source of google-play-services.jar
I can't open the sources of google-play-serveices.jar classes because eclepse says "Source not found". How to see their source?