|
Sorry but I still do not understand what you mean by 'convert'. A file (as I said previously) is merely a stream of bytes, so reading it into memory you automatically have an array. What exactly are you trying to do with this file's content?
Use the best guess
|
|
|
|
|
Hi,
I have one file test.png I want to convert to array 2d of hexadecimal.
Ex: test.png ---Convert----> unsigned char test [][]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,}};
for Example,
Thank you for helping me..!
|
|
|
|
|
That is the third time you have posted exactly the same information which gives no explanation of what you mean by "convert". As I said before, if you read the file into memory it will be in an array of bytes, so what do you want to convert it to?
Use the best guess
|
|
|
|
|
Oh..!
For example: I have Test.bmp I want to convert it to hexadecimal of array 2d.
|
|
|
|
|
There is little point in you continuing to repeat the same sentence which makes no sense. I cannot repeat enough that a file (any file) is a 1-dimensional array of bytes, so what exactly are you trying to convert it into, and how do you expect to make it 2-dimensional?
Use the best guess
|
|
|
|
|
|
Do you mean you don't know what you want to do? In that case, what was the point of this thread?
Use the best guess
|
|
|
|
|
How to create doc file in java?
i did something in which poi api but d't work properly..please any one help me...
|
|
|
|
|
Please try doing a bit of research before posting questions like this. If you have a specific problem then show what you have done and what errors you receive. But don't assume that we can guess what is happening in your program.
|
|
|
|
|
k first i would like to say sorry to u for d't get any research with those questions..afterwards i will post recent questions...
|
|
|
|
|
Keep it to the POI API. That is working, although it is still under construction.
You can find some examples in the Unit Tests of POI-HWPF[^].
|
|
|
|
|
I'm new to java..how to connect java with sql server 2008?then what are all the software we need?
Thanks in Advance,
Thirunavukkarasu Dhanushkodi
|
|
|
|
|
Putting the title of your post into Google would have soon found you the JDBC Trail[^].
|
|
|
|
|
|
|
You could post that question into Google and get lots of useful information.
|
|
|
|
|
import java.awt.*;
import java.applet.Applet;
import javax.swing.*;
import java.awt.event.*;
public class Calendar extends Applet
{
int Year=0;
int a=0;
int b=0, c=0;
int StartOfDay=0;
int Month=0;
int Day=0;
String Holder="";
int DaysInMonth[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
String ArrMonths[]=
{
"\nJanuary",
"\nFebruary",
"\nMarch",
"\nApril",
"\nMay",
"\nJune",
"\nJuly",
"\nAugust",
"\nSeptember",
"\nOctober",
"\nNovember",
"\nDecember"
};
JLabel lblInput= new JLabel("Input year:");
JTextField txtInput= new JTextField("2012",4);
JLabel[] lbl1= new JLabel[12];
JButton btnOk=new JButton("OK");
}
sir .. can you help me ..
There was no error . but when i try to run file .. it failed to initialize . I just want to have a calendar in Java for our finals .. I think its not really difficult .. so i choose this proposal. thanks .. I hop you help me guys
NOTE: Sorry guys it was my first time to do java .. so please don't laugh at me .. LOL
|
|
|
|
|
You have not added any actual code to this to do anything. I suggest you work through this tutorial[^].
|
|
|
|
|
Sir ... I dont really have Idea .. Is it possible to do a calendar in applet ? . just a simple calendar ? ..
|
|
|
|
|
mobi35 wrote: I dont really have Idea Then go and work through the tutorial that I gave you a link for.
|
|
|
|
|
i appreciate ur knowledge pa...
my suggestion is use browser code or (html) code to invoke applet into browser..try it..my dear friend...
|
|
|
|
|
some one please tell me what is the problem
here is the code
public class sortm {
public static void main(String args[])
{
int a[]={5,3,7,2,8};
int b[]={1,9,4,8,10};
int i=1;
int j=1;
int t=0;
int s=0;
for( i=1;i<=5;i++)
{
if(a[i]>a[i+1])
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
}
for( i=1;i<=5;i++){
System.out.println(a[i]);
}
for(j=0;j<=5;j++)
{
if(b[j]>b[j+1])
s=b[j];
b[j]=b[j+1];
b[j+1]=s;
}
for(j=0;j<=5;j++)
{
System.out.println(b[j]);
}
}
}
and this what running say :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at sortm.main(sortm.java:14)
|
|
|
|
|
in the above code you stored array with five elements so yor index range from 0 to 4
you mention i=1 and maxmium is 5
so for iterations i become 5 at that time it will give arrayoutbound exception
you can just change
for( i=1;i<5;i++)
{
if(a[i]>a[i+1])
t=a[i];
a[i]=a[i+1];
a[i+1]=t;
}
it will execute
|
|
|
|
|
sorry but you solution didnt work,
there is problem in in this statement a[i]>a[i+1] ,when i be 5 ,it is in a[5]>a[6], so compiler search for a[6] and dont found,so here gave me the problem ,and by the way what is a[i]>a[i+1] i didnt get it
thank you
modified 7-Feb-13 14:40pm.
|
|
|
|
|
OmarSH wrote: some one please tell me what is the problem
Your arrays have indexes from 0 to 4. So 0, 1, 2, 3, 4 are the ONLY valid values.
Print out 'i' and print out 'i+1' BEFORE you use it as an array index. If either of those are greater than 4 then it is a bug.
Print out 'j' and print out 'j+1' BEFORE you use it as an array index. If either of those are greater than 4 then it is a bug.
|
|
|
|
|