thanks again... it works... one last qn(hopefully).. .
I know i can use
for(Int i : map.keyset())
to go through the whole map, but if I want to just take out the first ten, is there another type of for loop to do it?...
User Profile
Collapse
-
ok will try it out...
btw it will be from the lowest to highest right? Is there anyway to get from the back or sort it the other way around since I need the highest frequency?...Leave a comment:
-
Sorrting Elements In Map Collection Based On Value
I need to sort out based on frequency certain events that happen.
I use a map with the event name as the key(String) and the frequency(Integ er) as the value and every time an event happens.
I have no problems with the part of adding and updating but am abit stuck at the sorting part as I need to display the events sorted from higest frequency to lowest.
At first I was thinking of putting them into another... -
I did a bit of a test and found out the lengths varies abit from 46 to 48 even though i was signing the same thing.
Decided to write the length of the signature to at the start of the file but am still trying to find out if there is a better way...Leave a comment:
-
Digital Signature with DSA
Got a question:
I managed to generate a key pair with DSA and have no problems signing and verifying with them.
But I need to attach the signature to the start of a file and have the receiver receive the file, check the signature before processing the rest of the file.
Is there a fixed length for the key size so that the receiver knows how many of the bytes in the start of the file is for the signature?... -
Java AVI Player
Got an assigment where I need to create a plugin for any media player that plays AVI using my current java program which does some processing to the AVI file.
Of cos I need to modify my program into a plugin but was wondering if there are any media player out on the web that can use a java program as a plugin.
Thanks. -
ok one of those weird days... now its works... -_-'''
anyway thanks again for the help :)Leave a comment:
-
i have a problem becos while the file size is the same, the file isnt...
I solved the part about the last byte[] being smaller than the block size so my files are the same size now. But they are not the same file. As in if its a picture file, the output will be corrupted. But it works fine with text...Leave a comment:
-
what i need to do is to read in a file, chop it up into blocks of a certain size, do some checking to the blocks and write them out if they pass the checks.
What I am trying to do now is to make sure that what i read in as blocks are written out properly so the file is still the same....Leave a comment:
-
-
but now i cant seem to write properly... lol... i check the output file and its the same size as the input file...
my codes:
...Code:ArrayList<byte[]> al = new ArrayList<byte[]>(); byte[] b = new byte[bSize]; FileInputStream fIn = new FileInputStream(inFile); BufferedInputStream in = new BufferedInputStream(fIn);
Leave a comment:
-
oh ok... haha... got a bit confused just now...
ok so lets say i have a file size of 10000 bytes and a block size of 100 bytes.
so i would have 100 byte[100] in the arraylist....Leave a comment:
-
got another qn though... i would need an integer to define the size of the byte[] array and am worried that if the file is too big, the integer data type cant fit it.
Wanted to use long but the byte[] can only take in integer. Is there a way around it or the integer data type should be big enough.
I would assume a 200~300 mb file would be the biggest I ever have to handle.Leave a comment:
-
oh btw... just to confirm, when i read in the whole file at the first go before chopping them up into blocks, Byte[19] would refer to the 20th byte in the file right?Leave a comment:
-
-
Handling Blocks of Bytes
Just a question on handling "Byte[]" in java.
I have to read in a file of any type and chop it up into blocks for processing later on.
Was wondering if I got do a Byte[][] to keep the Byte[] in an array or would something else be a better way of doing it as I do now know how many elements the array of Byte[] can hold as the file might be huge and the blocks might be small.
Thanks. :) -
-
Reading & Writting Binary File
Got a question about reading and writing binary files.
I know that to write a value(integer) to a binary file I can use the fileoutputstrea m to do it.
...Code:try { // Create an output stream to the file. FileOutputStream file_output = new FileOutputStream (outFile); //for(int i = 0; i < cInt.length; -
-
binary string to integer
Another question to ask about built in java functions.
I know that there is a Integer.toBinar yString function where I can get the binary value of an integer in a string representation.
Example : from 107 i get "1101011"
Question would be, is there a function where I can convert back from string to integer. Like int i = functionName("1 101011") where i will contain 107.
...
No activity results to display
Show More
Leave a comment: