两个int数组比较获取不同值,最好给个例子
解决方案 »
- 执行getHibernateTemplate.save(user)后,控制台已经显示出sql插入语句,但数据库里并没有数据?
- 新手求解,struts2中action的参数传递问题,跪求!!!!
- struts2.0action问题
- 请Spring高手回答:Spring2和Struts1.X整合中MappingDispatchActionSupport的用法方法
- 如何使用SAAJ 通过WSDL访问一个WEBSERVICE(在线等)
- 救急:系统集成问题
- 一个关于连接Oracle的问题
- 如何用程序实现xls和doc文件转换成pdf文件
- 配置问题:jb8+weblogic7
- 一对多的单向关联中,“一”的一端删除时怎么把多的一端也删除了(多的一端关联,一的一端没关联)?
- Unix与windows下换行符的问题??? 在程序中如何转换(小弟刚注册的号,没多少分)
- jsp 论坛问题
int[] b={0,1,5,3};
for(int x=0;x<a.length;x++)
for(int y=0; y<b.length;y++){
if(a[x]==b[y]){
System.out.println(a[x]);
}
}
估计是这样,对吧?
for(int i = 0; i < c.length(); i++)
c = 0;
for(int i = 0; i < a.length(); i++)
{
for(int j = 0; j < b.length(); j++)
{
if(a[i] == b[j])
{
c[i] = 1;
break;
}
}
System.out.println(a[i]);
}
for(int i = 0; i < c.length(); i++)
if(c[i] == 0)
System.out.println(b[i]);
int[] a = { 1, 2, 3, 4 };
int[] b = { 0, 1, 5, 3 };
int[] c = new int[a.length+b.length];
int[] d= new int[a.length+b.length];
for(int n=0;n<a.length;n++)
{
c[n]=a[n];
}
for(int k=a.length;k<c.length;k++)
{
c[k]=b[k-a.length];
}
int z = 0;
for (int x = 0; x < a.length; x++)
{
for (int y = 0; y < b.length; y++)
{
if (a[x] == b[y])
{
d[z]=a[x];
z++;
}
}
}
for (int m = 0; m < c.length; m++)
{
for(int h=0;h<d.length;h++)
{
if(d[h]!=0)
{
if (c[m]== d[h])
{
c[m]=-1;
}
}
}
}
for(int j=0;j<c.length;j++)
{
if(c[j]!=-1)
{
System.out.print(c[j]);
}
}