将二进制序列放入arraylist [英] putting binary sequence into arraylist
本文介绍了将二进制序列放入arraylist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能给我任何线索如何将二进制序列(例如10110011)放入arraylist,以便它可以像这样存储int [] binary = {1,0,1,1,0,0,1,1};?
can anyone give me any clue how to put binary sequence such as 10110011 into arraylist so it can store like this int[]binary={1,0,1,1,0,0,1,1};?
推荐答案
请即使先尝试使用google,
看看,
导入java.util.*;
Please try google first even then,
take a look,
import java.util.*;
public class ArrayListDemo{
public static void main(String[] args) {
ArrayList<Object> arl=new ArrayList<Object>();
Boolean i1=new Boolean ("true");
Boolean i2=new Boolean ("false");
Boolean i3=new Boolean ("true");
Boolean i4=new Boolean ("true");
String s1="tapan";
System.out.println("The content of arraylist is: " + arl);
System.out.println("The size of an arraylist is: " + arl.size());
arl.add(i1);
arl.add(i2);
arl.add(s1);
System.out.println("The content of arraylist is: " + arl);
System.out.println("The size of an arraylist is: " + arl.size());
arl.add(i1);
arl.add(i2);
arl.add(i3);
arl.add(i4);
Boolean i5=new Boolean ("false");
arl.add(i5);
System.out.println("The content of arraylist is: " + arl);
System.out.println("The size of an arraylist is: " + arl.size());
arl.remove(3);
Object a=arl.clone();
System.out.println("The clone is: " + a);
System.out.println("The content of arraylist is: " + arl);
System.out.println("The size of an arraylist is: " + arl.size());
}
}
这篇关于将二进制序列放入arraylist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文