Quantcast
Channel: BlogoSfera » length
Browsing all 61 articles
Browse latest View live

Logic error in string building

I have a program I’m writing that’s supposed to encrypt and decrypt a predetermined set of strings. The main class was provided and I had to write the dependencies, but my objects are not getting...

View Article


Finding Pythogorean Triplets Sum Given a Max Length

Here recently I’ve been unable to determine a solution to a problem I have. My code is skipping over certain Pythagorean Triplets during the process and therefore giving the incorrect sum. For example...

View Article


how to inverse a string

I have this homework from the school, however Im not sure Im doing wrong the second array does not takes the values of the first one, can you help me please? public static void main(String[] rpp) {...

View Article

Set a value to an object array

public class Jeux { public static void main(String [] args) { int nPlayer= 0; String name; boolean ok = false; Player[] groupe = null; do { try { System.out.print("How many player: "); nPlayer=...

View Article

How do I ask the user when he/she wants to quit the program

Here’s the program that I’m working on but I’m having problems with figuring out how to ask the user if they are done with it by saying a word or number. import java.util.Scanner; class paliindrome {...

View Article


i want to insert integers into 2d array via 2 textfields one for columns and...

private void enterbtnActionPerformed(java.awt.event.ActionEvent evt) { { int [][] array = new int [4][4]; // my array for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].length;...

View Article

Exception with System.arraycopy in Java

I’ve been having trouble with this method class. I used System.arraycopy but admittedly how it works 100%. I’ve been getting this error when trying to test it: Exception in thread "main"...

View Article

Stanford NLP: "No annotator named sentiment" error

I’m trying to apply Sentiment Analysis for a dataset containing tweets that I already collected, for some experiments I run for my thesis. I have followed various tutorials on the Internet and my code...

View Article


Permutation of words starting and ending with given character and are of...

I have been trying to permute set of words like {‘AB’, ‘BA’, ‘AA’,’BA’} such that words start with ‘A’ or ‘B’ and end with ‘A’ or ‘B’ as given input. And word should be of length 3(measured in words)...

View Article


Java program taking input and storing in pre-defined array

Here is a snippet of my code. I have to take user input of integers and determine what is a ODD and EVEN and NEGATIVE int and populate them into an EVEN array, an ODD array and a NEGATIVE Array. Every...

View Article

Java hibernate: How to set column varchar to max?

I have column String post. I want map this post like a string. I am using: @Column(updatable = true, name = "Post", nullable = false, length=50) public String getPost() { return post; } This code...

View Article

Java – String[] str = new String[0] is valid [duplicate]

This question already has an answer here: use of array of zero length 3 answers Java provide a way to declare a String array with zero length as String[] str = new String[0]; It’s totally valid but why...

View Article

Trouble with file management [duplicate]

This question already has an answer here: How to create a file and write to a file in Java? 22 answers i have a task in java generated from an exercise randomizer application and it’s quite a pain. The...

View Article


About .length property for int

So i am studying on a code used to convert scores to grade, I am a bit confused with the following steps: public static String score2grade(int score){ int [] bottoms = {95, 90, 85, 80}; String [] grade...

View Article

Counting duplicates in one array using another array fails to execute (Java)

Have 2 hours to finish my homework, and I’m stuck at this last method which to me seems to be correct, but the debugger fails to execute it. In the method below (getPopularLine), I need to find a bus...

View Article


Shifting a 2D array to the left loop

I have a 2D array with values in it. Example below: 010101 101010 010101 I want to create a loop that shifts these values to the left like the example below. 101010 010101 101010 So the element that...

View Article

Need help understanding org.bouncycastle.asn1.ASN1InputStream...

I am working on a decoder for ASN.1 encrypted file, and getting java.io.IOException: DER length more than 4 bytes: 63 I want to understand why bouncy castle is throwing this exception. If someone can...

View Article


how java awt handling event works? [duplicate]

This question already has an answer here: What is a Null Pointer Exception, and how do I fix it? 12 answers I dont know what is the problem of my code but when i click the Ascending button.Exception in...

View Article

Get actual length of the defined String in Java

I’ve defined String as String s = "\\"; int length = s.length(); // returns 1 System.out.println(s); // prints only one "\" How can I get it’s size equal to 2 ? UPD: The problem is not in getting...

View Article

How do I insert "-" and "=" when printing 2D arrays

I am a newbie in Java programming. I have written a method that subtracts a 3-by-3 matrix from another. I am having trouble inserting “-” and “=” after the first and second matrices respectively. My...

View Article
Browsing all 61 articles
Browse latest View live