I did try your prototype, but it didn't produce the required output in bytes. Maybe it just needed convert back to hex integers. It's odd that I don't see the necessary logic in your code that contains the conversion table from input bits to outputbits. I'm sure it's probably there, but it's not obvious to me. |
|
There is no way to do anything instananeously. Everything takes some amount of time. If you want to do something to every element in an array, you'll have to iterate over that array (like with a for loop) and do that thing to each element. What makes you think a for loop will be too slow? Have you measured it? |
Hi im struggling with a couple of questions, if you can offer any help that would be great. c) The java code required to write an integer to a text field on a Java form is:- int age; txtAge.setText(Integer.toString(age)); Describe what the second line does in terms of classes and methods. Your answer should mention two operations. What is the proper ... |
The data is properly buffered and is outputting on a line by line basis. What i need to do is parse each line and put each of the three X, Y and Z values into a separate array or list or something so i can do things like find the average. I can't use a basic array because i need to ... |
|
If you don't want to go recursive, then it seems to me that in the example you give: a1 = { 2 2 3 }; yielding {0,0,0} {0,0,1} {0,0,2} {0,1,0} {0,1,1} {0,1,2} {1,0,0} {1,0,1} {1,0,2} {1,1,0} {1,1,1} {1,1,2} the resulting sequence of array values looks a lot like numbers. It's like the right hand end (the "ones") is base 3, the ... |
|
I have a program that uses JTree components. each leaf holds some values that I want to record and retrieve from an array. these leaf can return an index value that I can use, but these index values are not unique from parent paths or root paths. the only thing that is unique and stay consistent is the actual path from ... |
I could write it myself, but It occurred to me, can BlueJ do this with a class library already? I'm starting with an int. I want to convert it into an array or a arrayList of boolean values that will reprenent the binary of the value. For example: 0 = 0 1 = 1 2 = 1, 0 3 = 1, ... |
hi all. i have two public classes X and Y. class Y has 'n' number of 'public static final int' variables and that is all. also, i cannot edit class Y. i want to create a dynamic int array in class X which gets and stores all 'n' int variables in class Y without referencing each variable manually. how should i ... |
|
Why do you want a 2d array? What are you going to do with it? As for hidden characters in the input...if that happens, it's going to be difficult to correct for unless you can establish some kind of rule about what data you throw out. Note that simply casting out non-digits won't help, because non-printing characters might include digits (if ... |
Java is always pass by value. In the case of objects (arrays are objects) the value passed is the reference to the object. So any changes you make will be reflected in your original object because the local variable/parameter and the original variable both refer to the same object. If you want to leave the original array unchanged then you will ... |
|
Hello, I am trying to find the best way to enumerate an array of strings to integers. This string array is thousands in number and contains non-unique values. I also don't know before run-time what those values are, so I have to dynamically determine the enumeration. For example a user reads in an array of colors (but we didnt know this ... |
|
I need an int[] array for which I do not know the length at compilation time. So I am using a Vector vector = new Vector(), the elements of which I define as of type Integer. However, I have a method which calls an int[] array and not a Vector. How can I convert my vector to an int[] array? I ... |
|
|
|
|
I believe unpacking it from a String is probably more efficient than reading from a binary file, since the String will be stored in the class file as a readonly String literal in its constant pool, and will be shared by all instances behind-the-scene. It's also why popular software packages like JLex and Yylex use exactly this same approach: packing an ... |
I'm trying to create a program to print the maximum element (largest number) of an element stored in some array values. I can't figure out the right for (int code. I need it to compare the maximum with the next element. And also need to check if the next element is bigger then resest the max to that. Here is what ... |
|
As part of my program I have the user input a string of numbers separated by spaces that I then separate and put into an array like so... String[] individualNumbers = numbers.split(" +"); I then need to convert these numbers to an int, which I can do temporarily in a loop using... for(int i=0; i |
|
Hi, I looked over Java doc and couldn't find the answer... Please help. I need to create an array or something equivalent (a record) contain 2 data types/fields. Let's say I need something like: a list of name and age... I believe Java has something like that but couldn't think of any for now. Please give me some hints how I ... |
Hi, I have a question if i have a intger array which has elements like a[0]=43; a[1]=2; a[2]=3; a[4]=4; can i put them in a string in such a way that a string would have contents str= "43,2,3,4". Please suggest me how to do that ... Just to mention I only have a integer array which finally i want to convert ... |
More specifically, your replace function is doing this ... if the value at a,0 is equal to the current array index a, set the array index a to the value at a,1. This does not replace the value at a,0 with the value at a,1. With your specific data, it updates the loop index prematurely, so one or more values are ... |
This is what I've got import java.util.*; import javax.swing.*; class multiplyArray { public static void main(String[] args) throws Exception { Scanner input = new Scanner(System.in); System.out.println("Enter some numbers (all on one line, separated by spaces):"); String line = input.nextLine(); String[] numbers = line.split(" +"); int[] a = new int[numbers.length]; for(int i=0; i |