• 关于 String+String 的搜索结果

问题

Android SQLite同一DB中创建多表

爵霸 2019-12-01 19:46:22 1391 浏览量 回答数 2

问题

如何利用jtable删除数据库一条信息

蛮大人123 2019-12-01 19:28:01 970 浏览量 回答数 1

回答

递归和循环本质是都是多次执行,是可以互相替代的,只是递归是另外一种思想,你的代码是递归但是,你的代码没办法完成的题目中说的结果,递归思想有问题,没有得出全部结果,一个长度为n的个字符不重复的字符串有n!种排列这个应该都知道吧,你可以执行adcd是无法出来24种结果的。下面是我刚才写的一个递归,没仔细查,可能有不对的,map主要是用来去重的 public static void main (String[] args){ String a = "abcd"; test t = new test(); t.permute(a); } public void permute ( String str ) { Map<String,String> m = newPermute(str.substring(1),str.toCharArray()[0]+""); for (Map.Entry<String, String> entry : m.entrySet()) { System.out.println(entry.getKey().toString()); } } private Map<String,String> newPermute(String string,String a){ Map<String,String> map = new HashMap<String,String>(); char[] str = string.toCharArray(); if(str.length==1){ map.put(str[0]+a,str[0]+a); map.put(a+str[0],a+str[0]); return map; }else{ Map<String,String> m = newPermute(string.substring(1),str[0]+""); for (Map.Entry<String, String> entry : m.entrySet()) { String key = entry.getKey().toString(); map.put(a+key,a+key); map.put(key+a,key+a); for(int i = 1;i < key.toCharArray().length;i++){ String newKey = key.substring(0,i)+a+key.substring(i); map.put(newKey,newKey); } } } return map; }

蛮大人123 2019-12-02 02:02:27 0 浏览量 回答数 0

试用中心

为您提供0门槛上云实践机会,企业用户最高免费12个月

问题

hql语句查询到一个Object强制转换为一个pojo不能成功,求助! ! !

爵霸 2019-12-01 20:03:48 1189 浏览量 回答数 1

问题

帮忙看下代码越界问题

蛮大人123 2019-12-01 19:44:28 801 浏览量 回答数 1

问题

jquery的一个onmouseover

a123456678 2019-12-01 20:19:50 883 浏览量 回答数 1

回答

package mimaxue; public class StrBinaryTurn { //将Unicode字符串转换成bool型数组 public boolean[] StrToBool(String input){ boolean[] output=Binstr16ToBool(BinstrToBinstr16(StrToBinstr(input))); return output; } //将bool型数组转换成Unicode字符串 public String BoolToStr(boolean[] input){ String output=BinstrToStr(Binstr16ToBinstr(BoolToBinstr16(input))); return output; } //将字符串转换成二进制字符串,以空格相隔 private String StrToBinstr(String str) { char[] strChar=str.toCharArray(); String result=""; for(int i=0;i<strChar.length;i++){ result +=Integer.toBinaryString(strChar[i])+ " "; } return result; } //将二进制字符串转换成Unicode字符串 private String BinstrToStr(String binStr) { String[] tempStr=StrToStrArray(binStr); char[] tempChar=new char[tempStr.length]; for(int i=0;i<tempStr.length;i++) { tempChar[i]=BinstrToChar(tempStr[i]); } return String.valueOf(tempChar); } //将二进制字符串格式化成全16位带空格的Binstr private String BinstrToBinstr16(String input){ StringBuffer output=new StringBuffer(); String[] tempStr=StrToStrArray(input); for(int i=0;i<tempStr.length;i++){ for(int j=16-tempStr[i].length();j>0;j--) output.append('0'); output.append(tempStr[i]+" "); } return output.toString(); } //将全16位带空格的Binstr转化成去0前缀的带空格Binstr private String Binstr16ToBinstr(String input){ StringBuffer output=new StringBuffer(); String[] tempStr=StrToStrArray(input); for(int i=0;i<tempStr.length;i++){ for(int j=0;j<16;j++){ if(tempStr[i].charAt(j)=='1'){ output.append(tempStr[i].substring(j)+" "); break; } if(j==15&&tempStr[i].charAt(j)=='0') output.append("0"+" "); } } return output.toString(); } //二进制字串转化为boolean型数组 输入16位有空格的Binstr private boolean[] Binstr16ToBool(String input){ String[] tempStr=StrToStrArray(input); boolean[] output=new boolean[tempStr.length*16]; for(int i=0,j=0;i<input.length();i++,j++) if(input.charAt(i)=='1') output[j]=true; else if(input.charAt(i)=='0') output[j]=false; else j--; return output; } //boolean型数组转化为二进制字串 返回带0前缀16位有空格的Binstr private String BoolToBinstr16(boolean[] input){ StringBuffer output=new StringBuffer(); for(int i=0;i<input.length;i++){ if(input[i]) output.append('1'); else output.append('0'); if((i+1)%16==0) output.append(' '); } output.append(' '); return output.toString(); } //将二进制字符串转换为char private char BinstrToChar(String binStr){ int[] temp=BinstrToIntArray(binStr); int sum=0; for(int i=0; i<temp.length;i++){ sum +=temp[temp.length-1-i]<<i; } return (char)sum; } //将初始二进制字符串转换成字符串数组,以空格相隔 private String[] StrToStrArray(String str) { return str.split(" "); } //将二进制字符串转换成int数组 private int[] BinstrToIntArray(String binStr) { char[] temp=binStr.toCharArray(); int[] result=new int[temp.length]; for(int i=0;i<temp.length;i++) { result[i]=temp[i]-48; } return result; } }

晚来风急 2019-12-02 01:28:08 0 浏览量 回答数 0

问题

api驾驶证识别中的案例,签名认证失败,错误提示401,身份认证失败

一起来嗨 2019-12-01 20:25:27 1687 浏览量 回答数 1

回答

<string name="json_array"> {"calendar": {"calendarlist": [ {"calendar_id":"1705","title":"(\u4eb2\u5b50)ddssd","category_name":"\u9ed8\u8ba4\u5206\u7c7b","showtime":"1288927800","endshowtime":"1288931400","allDay":false}, {"calendar_id":"1706","title":"(\u65c5\u884c)","category_name":"\u9ed8\u8ba4\u5206\u7c7b","showtime":"1288933200","endshowtime":"1288936800","allDay":false} ] } } </string> 解析代码: public void parseJsonArray(String string){ try { JSONObject jsonObject = new JSONObject(string).getJSONObject("calendar"); JSONArray jsonArray = jsonObject.getJSONArray("calendarlist"); StringBuffer sb = new StringBuffer(); for(int i = 0;i < jsonArray.length();i ++){ JSONObject json = (JSONObject) jsonArray.opt(i); String calendar_id = json.getString("calendar_id"); String title = json.getString("title"); String category_name = json.getString("category_name"); String showtime = json.getString("showtime"); String endshowtime = json.getString("endshowtime"); String allDay = json.getString("allDay"); sb.append("calendar_id: " + calendar_id + "\n\n" + "title: " + title + "\n\n" + "category_name: " + category_name + "\n\n" + "showtime: " + showtime + "\n\n" + "endshowtime: " + endshowtime + "\n\n" + "allDay: " + allDay + "\n\n" + "-------------------------------------\n\n"); } text.setText(sb.toString()); } catch (JSONException e) { e.printStackTrace(); } }

蛮大人123 2019-12-02 01:47:38 0 浏览量 回答数 0

回答

通过id和no组合分组,ROW_NUMBER()over (partition by id+','+no ) rn先对A表进行行编号,条件多加一个 rn=1update B set _flg = 'update', b_string1 = t4.a_string1, b_string2 = t4.a_string2, b_string3 = t4.a_string3, b_string4 = t4.a_string4, b_string5 = t4.a_string5, update_by = current_user, update_date = getdate() from B t3 inner join (select a.*,ROW_NUMBER()over (partition by id+','+no ) rn from a) t4 on t3.id = t4.id and t3.no = t4.no where exists ( select 1 from A t5 where t5.id + ',' +t5.no = t3.id + ',' + t3.no and ( t3.b_string1 <> t5.a_string1 or t3.b_string2 <> t5.a_string2 or t3.b_string3 <> t5.a_string3 or t3.b_string4 <> t5.a_string4 or t3.b_string5 <> t5.a_string5 ) ) and t4.rn=1没有建表语句和数据,SQL没有调测,只是这么一个意思。

吴孟桥 2019-12-02 02:46:25 0 浏览量 回答数 0

回答

public class MediocreExecJavac { public void runCmd(String command) { try { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(command); InputStream stderr = proc.getErrorStream(); InputStreamReader isr = new InputStreamReader(stderr); BufferedReader br = new BufferedReader(isr); String line = null; while ( (line = br.readLine()) != null) System.out.println(line); int exitVal = proc.waitFor(); System.out.println("Process exitValue: " + exitVal); } catch (Throwable t) { t.printStackTrace(); } } public boolean transfer(String infile,String outfile) { String avitoflv = "ffmpeg -i "+infile+" -ar 22050 -ab 56 -f flv -y -s 320x240 "+outfile; String flvto3gp = "ffmpeg -i " + infile + " -ar 8000 -ac 1 -acodec amr_nb -vcodec h263 -s 176x144 -r 12 -b 30 -ab 12 " + outfile; String avito3gp = "ffmpeg -i " + infile + " -ar 8000 -ac 1 -acodec amr_nb -vcodec h263 -s 176x144 -r 12 -b 30 -ab 12 " + outfile; String avitojpg = "ffmpeg -i " + infile + " -y -f image2 -ss 00:00:10 -t 00:00:01 -s 350x240 " + outfile; try { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(avitoflv); InputStream stderr = proc.getErrorStream(); InputStreamReader isr = new InputStreamReader(stderr); BufferedReader br = new BufferedReader(isr); String line = null; while ( (line = br.readLine()) != null) System.out.println(line); int exitVal = proc.waitFor(); System.out.println("Process exitValue: " + exitVal); } catch (Throwable t) { t.printStackTrace(); return false; } return true; } public static String readFile(String fileName,int id) { String dataStr = ""; FileInputStream fis = null; try { FileReader file = new FileReader(fileName);//建立FileReader对象,并实例化为fr BufferedReader br=new BufferedReader(file);//建立BufferedReader对象,并实例化为br String Line=br.readLine();//从文件读取一行字符串 dataStr=Line; br.close();//关闭BufferedReader对象 } catch(Exception e) { } finally { try { if(fis!=null) fis.close(); } catch(Exception e) {} } return dataStr; } public String readtime(String file) { String str="/root/Desktop/info.txt"; String timelen = ""; String cmd = "timelen "+file; runCmd(cmd); timelen=readFile(str,1); return timelen; } public static void main(String args[]) { MediocreExecJavac me = new MediocreExecJavac(); String infile = "/root/Desktop/a.mp4"; String outfile = "/root/Desktop/1.flv"; String timelen = me.readtime(infile); System.out.println("timelen is :" + timelen); if(me.transfer(infile,outfile)) { System.out.println("the transfer is ok!"); } else { System.out.println("the transfer is error!"); } } }

蛮大人123 2019-12-02 01:52:04 0 浏览量 回答数 0

回答

提供一种程序实现的思路 具体还的你自己修改· import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Test { /** * @param args */ public static void main(String[] args) { Map<String,String[]> map=new HashMap<String,String[]>();//存放叠加的数据 List<String[]> list=new ArrayList<String[]>();//数据list list.add(new String[]{"金点子","封面","彩板","5","1","4"}); list.add(new String[]{"金点子","封面","彩板","5","1","4"}); list.add(new String[]{"金点子","封面","彩板","5","1","4"}); list.add(new String[]{"金点子","封面","彩板","5","1","4"}); list.add(new String[]{"金点子","头版","信息版","8","1","7"}); list.add(new String[]{"金点子","头版","信息版","5","1","4"}); list.add(new String[]{"金点子","头版","信息版","12","1","11"}); for(String[] strs : list){//循环数据 String[] strTemp=map.get(strs[1]);//判断是否已存在 if(strTemp!=null){//存在就数据相加 strTemp[3]=(Integer.parseInt(strTemp[3])+Integer.parseInt(strs[3]))+""; strTemp[4]=(Integer.parseInt(strTemp[4])+Integer.parseInt(strs[4]))+""; strTemp[5]=(Integer.parseInt(strTemp[5])+Integer.parseInt(strs[5]))+""; }else{//不存在就添加数据 map.put(strs[1], strs); } } //迭代输出结果 System.out.println("DM\t版面\t类型\t总数量\t已使用\t空闲"); for(String key : map.keySet()){ String[] strTemp=map.get(key); System.out.println(strTemp[0]+"\t"+strTemp[1]+"\t"+strTemp[2]+"\t"+strTemp[3]+"\t"+strTemp[4]+"\t"+strTemp[5]); } } }

小旋风柴进 2019-12-02 01:58:13 0 浏览量 回答数 0

问题

怎么提高向mysql中插入数据的效率

爵霸 2019-12-01 19:59:08 796 浏览量 回答数 1

回答

public static String foo(String s, String find) { String arr[] = s.split("\\."); for (int i = 1; i < arr.length - 1; i++) { int pos =arr[i].indexOf(find); if ( pos != -1) arr[i] = arr[i].substring(0,pos) + (char)(arr[i].charAt(pos)+32)+arr[i].substring(pos+1); if(pos == 0){ return arr[i] + "." + arr[i + 1]; } return arr[i - 1] + "." + arr[i] + "." + arr[i + 1]; } return ""; }

蛮大人123 2019-12-02 02:16:23 0 浏览量 回答数 0

回答

JDK6.0支持JAVA与JAVASCRIPT之间的互相调用,下面的实例将演示几种JAVA代码调用执行JAVASCRIPT代码的方法。   view plaincopy to clipboardprint?   import javax.script.Invocable;   import javax.script.ScriptEngine;   import javax.script.ScriptEngineManager;   import javax.script.ScriptException;      public class Test {       public static void main(String[] args) {    ScriptEngineManager sem = new ScriptEngineManager();    ScriptEngine se = sem.getEngineByName("javascript");    try {    //调用直接JAVASCRIPT语句    se.eval("println('111');");    String tmpstr = "test string";    se.eval(("println('" + tmpstr + "');"));       //调用无参数方法JAVASCRIPT函数    se.eval("function sayHello() {"    + " print('Hello '+strname+'!');return 'my name is '+strname;" + "}");    Invocable invocableEngine = (Invocable) se;    se.put("strname", "testname");    String callbackvalue=(String) invocableEngine.invokeFunction("sayHello");    System.out.println(callbackvalue);       //调用有参数JAVASCRIPT函数    se.eval("function sayHello2(strname2) {"    + " print('Hello '+strname+'!');return 'my name is '+strname2;" + "}");    callbackvalue=(String)invocableEngine.invokeFunction("sayHello2", "testname2");    System.out.println(callbackvalue);       } catch (ScriptException e) {    // TODO Auto-generated catch block    e.printStackTrace();    } catch (NoSuchMethodException e) {    // TODO Auto-generated catch block    e.printStackTrace();    }    }   }   public class Test {    public static void main(String[] args) {    ScriptEngineManager sem = new ScriptEngineManager();    ScriptEngine se = sem.getEngineByName("javascript");    try {    //调用直接JAVASCRIPT语句    se.eval("println('111');");    String tmpstr = "test string";    se.eval(("println('" + tmpstr + "');"));    //调用无参数方法JAVASCRIPT函数    se.eval("function sayHello() {"    + " print('Hello '+strname+'!');return 'my name is '+strname;" + "}");    Invocable invocableEngine = (Invocable) se;    se.put("strname", "testname");    String callbackvalue=(String) invocableEngine.invokeFunction("sayHello");    System.out.println(callbackvalue);       //调用有参数JAVASCRIPT函数    se.eval("function sayHello2(strname2) {"    + " print('Hello '+strname+'!');return 'my name is '+strname2;" + "}");    callbackvalue=(String)invocableEngine.invokeFunction("sayHello2", "testname2");    System.out.println(callbackvalue);       } catch (ScriptException e) {    // TODO Auto-generated catch block    e.printStackTrace();    } catch (NoSuchMethodException e) {    // TODO Auto-generated catch block    e.printStackTrace();    }    }   }   执行后,输出结果如下:  111  test string  Hello testname!my name is testname  Hello testname!my name is testname2   javax.script包为我们提供了不少用得上的类和方法,这样调用增加了前、后台之间的交互性,JAVASCRIPT函数可写在前台页面中,实现内容的变更对后台无影响,不用重新编译、发布即可生效。

蛮大人123 2019-12-02 02:32:00 0 浏览量 回答数 0

回答

public class Quine { public static void main(String[] args) { char q = 34; // Quotation mark character String[] l = { // Array of source code "public class Quine", "{", " public static void main(String[] args)", " {", " char q = 34; // Quotation mark character", " String[] l = { // Array of source code", " ", " };", " for(int i = 0; i < 6; i++) // Print opening code", " System.out.println(l[i]);", " for(int i = 0; i < l.length; i++) // Print string array", " System.out.println(l[6] + q + l[i] + q + ',');", " for(int i = 7; i < l.length; i++) // Print this code", " System.out.println(l[i]);", " }", "}", }; for(int i = 0; i < 6; i++) // Print opening code System.out.println(l[i]); for(int i = 0; i < l.length; i++) // Print string array System.out.println(l[6] + q + l[i] + q + ','); for(int i = 7; i < l.length; i++) // Print this code System.out.println(l[i]); } }

蛮大人123 2019-12-02 02:00:31 0 浏览量 回答数 0

问题

String sql = "insert into chat(from,to,message,sendtime) values("+from+","+to+","+message+","+dateTime+")";为何这一句插入不正确

爵霸 2019-12-01 19:39:32 1232 浏览量 回答数 1

回答

注释里有简单的解释 // 这一段应该是在拼(凑)数据 var string_ = ""; for (var i = 0; i < data.length; i++) { var string_f = data[i][0]; var string_n = data[i][1]; // 每次循环会往 string_ 里加一个对象的类(似) JSON 数据(之所以说是类 JSON, // 因为它不符合 JSON 的定义,但是这个字符串的内容是一个 JavaScript 对象的描述 string_ += "{text: '" + string_f + "', weight: '" + string_n + "',html: {'class': 'span_list',onmouseover:'on_mouseover(this,event)',onmouseout:'on_mouseout()'}},"; } // 定义一个函数,看样子应该是绑定给某个对象的 mouseover 事件 function on_mouseover(e, ev) { var txt = $(e).html(); $.each(data, function(i, item) { if (txt == item[0]) { var html = item[0] + "<br />频率:" + item[1]; $("#my_words").after("<div class='append_div' style='left:" + ev.clientX + "px; top:" + ev.clientY + "px; '>" + html + "</div>"); return; } }); } // jQCloud 是一个插件,看这里:http://www.oschina.net/p/jqcloud $(function() { $("#my_words").jQCloud(word_list); }); // 这里在使用上面拼出来的 string_,在它的前后加了 [],表示这是一个数组数据描述 var string_list = string_; var word_list = eval("[" + string_list + "]"); // 定义一个函数,也应该是在某个地方绑定给某个对象的 mouseout 事件的 function on_mouseout() { $(".append_div").remove(); } // mouseover 和 mouseout 事件通常成对出现,不过至少在都出现的情况下,放在一起比较好看不过拼数据那一块简直太弱了,jQCloud 要的本来就是个 JavaScript 数组,直接给数据就行,为毛要拼成字符串再来

a123456678 2019-12-02 02:08:54 0 浏览量 回答数 0

回答

您可以使用blast平展ArrayType列,并将嵌套的结构元素名称映射到所需的顶级列名,如下所示:import org.apache.spark.sql.functions._ case class S(a: String, b: String, c: String, d: String) val df = Seq( ("1.0", Seq(S("a1", "b1", "c1", "d1"))), ("2.0", Seq(S("a2", "b2", "c2", "d2"), S("a3", "b3", "c3", "d3")))).toDF("client_version", "filed") df.printSchema// root// |-- client_version: string (nullable = true)// |-- filed: array (nullable = true)// | |-- element: struct (containsNull = true)// | | |-- a: string (nullable = true)// | | |-- b: string (nullable = true)// | | |-- c: string (nullable = true)// | | |-- d: string (nullable = true) val dfFlattened = df.withColumn("filed_element", explode($"filed")) val structElements = dfFlattened.select($"filed_element.*").columns val dfResult = dfFlattened.select( col("client_version") +: structElements.map( c => col(s"filed_element.$c").as(s"filed_$c") ): _*) dfResult.show// +--------------+-------+-------+-------+-------+// |client_version|filed_a|filed_b|filed_c|filed_d|// +--------------+-------+-------+-------+-------+// | 1.0| a1| b1| c1| d1|// | 2.0| a2| b2| c2| d2|// | 2.0| a3| b3| c3| d3|// +--------------+-------+-------+-------+-------+ dfResult.printSchema// root// |-- client_version: string (nullable = true)// |-- filed_a: string (nullable = true)// |-- filed_b: string (nullable = true)// |-- filed_c: string (nullable = true)// |-- filed_d: string (nullable = true) 用于explode通过添加更多行来展平数组,然后select使用*符号将struct列重新置于顶部。 import org.apache.spark.sql.functions.{collect_list, explode, struct}import spark.implicits._ val df = Seq(("1", "a", "a", "a"), ("1", "b", "b", "b"), ("2", "a", "a", "a"), ("2", "b", "b", "b"), ("2", "c", "c", "c"), ("3", "a", "a","a")).toDF("idx", "A", "B", "C") .groupBy(("idx")) .agg(collect_list(struct("A", "B", "C")).as("nested_col")) df.printSchema()// root// |-- idx: string (nullable = true)// |-- nested_col: array (nullable = true)// | |-- element: struct (containsNull = true)// | | |-- A: string (nullable = true)// | | |-- B: string (nullable = true)// | | |-- C: string (nullable = true) df.show// +---+--------------------+// |idx| nested_col|// +---+--------------------+// | 3| [[a, a, a]]|// | 1|[[a, a, a], [b, b...|// | 2|[[a, a, a], [b, b...|// +---+--------------------+ val dfExploded = df.withColumn("exploded", explode($"nested_col")).drop("nested_col") dfExploded.show// +---+---------+// |idx| exploded|// +---+---------+// | 3|[a, a, a]|// | 1|[a, a, a]|// | 1|[b, b, b]|// | 2|[a, a, a]|// | 2|[b, b, b]|// | 2|[c, c, c]|// +---+---------+ val finalDF = dfExploded.select("idx", "exploded.*") finalDF.show// +---+---+---+---+// |idx| A| B| C|// +---+---+---+---+// | 3| a| a| a|// | 1| a| a| a|// | 1| b| b| b|// | 2| a| a| a|// | 2| b| b| b|// | 2| c| c| c|// +---+---+---+---+

社区小助手 2019-12-02 01:50:59 0 浏览量 回答数 0

回答

1.汉诺塔问题 import javax.swing.JOptionPane;   public class Hanoi {   private static final String DISK_B = "diskB";   private static final String DISK_C = "diskC";   private static final String DISK_A = "diskA";   static String from=DISK_A;   static String to=DISK_C;   static String mid=DISK_B;   public static void main(String[] args) {   String input=JOptionPane.showInputDialog("please input the number of the disks you want me move.");   int num=Integer.parseInt(input);   move(num,from,mid,to);   }   private static void move(int num, String from2, String mid2, String to2) {   if(num==1){   System.out.println("move disk 1 from "+from2+" to "+to2);   }   else {   move(num-1,from2,to2,mid2);   System.out.println("move disk "+num+" from "+from2+" to "+to2);   move(num-1,mid2,from2,to2);   }   }   } 2. 这是一个排列的例子,它所做的工作是将输入的一个字符串中的所有元素进行排序并输出,例如:你给出的参数是"abc" 则程序会输出:   abc   acb   bac   bca   cab   cba   (1)算法的出口在于:low=high也就是现在给出的排列元素只有一个时。   (2)算法的逼近过程:先确定排列的第一位元素,也就是循环中i所代表的元素,   然后low+1开始减少排列元素,如此下去,直到low=high   public static void permute(String str) {   char[] strArray = str.toCharArray();   permute(strArray, 0, strArray.length - 1);   }   public static void permute(char[] list, int low, int high) {   int i;   if (low == high) {   String cout = "";   for (i = 0; i <= high; i++)   cout += list[i];   System.out.println(cout);   } else {   for (i = low; i <= high; i++) {   char temp = list[low];   list[low] = list[i];   list[i] = temp;   permute(list, low + 1, high);   temp = list[low];   list[low] = list[i];   list[i] = temp;   }   }   }   3。这是一个组合的例子,与上述的例子相似,只是它所做的工作是,输出所给字符串中制定数目的元素的组合种类   (1)程序出口在于n=1,此时只要输出目标数组的所有元素即可   (2)逼近过程,当n>1 的时候,我们先取第一个元素放入目标数组中,然后n-1,如此下去,最后出来。   import javax.swing.JOptionPane;   public class Combination {   /**   * @param args   */   public static void main(String[] args) {   String input = JOptionPane.showInputDialog("please input your String: ");   String numString = JOptionPane.showInputDialog("please input the number of your Combination: ");   int num = Integer.parseInt(numString);   Combine(input, num);   }   private static void Combine(String input, int num) {   char[] a = input.toCharArray();   String b = "";   Combine(a, num, b, 0, a.length);   }   private static void Combine(char[] a, int num, String b, int low, int high) {   if (num == 0) {   System.out.println(b);   } else {   for (int i = low; i < a.length; i++) {   b += a[i];   Combine(a, num - 1, b, i+1, a.length);   b=b.substring(0, b.length()-1);   }   }   }   }

liujae 2019-12-02 01:24:12 0 浏览量 回答数 0

问题

Spring中 jdbctemplate中如何传递参数

小旋风柴进 2019-12-01 20:06:17 2100 浏览量 回答数 0

回答

不要用 PMSUtil 了,直接上 org.apache.commons.lang.StringUtils private Map versionCheck(Map mapParam) { Map msg = new HashMap(); msg.put("RESULT", "0000"); String isInternet = (String) mapParam.get("IS_INTERNET"); if (StringUtils.isBlank(isInternet)) { return msg; } String isCheck = SystemGlobals.getProperty("IS_CHECK"); if (!StringUtils.equals(isCheck, "1")) { return msg; } String globalVersions = SystemGlobals.getProperty("VERSION"); String currentVersion = (String) mapParam.get("VERSION"); if (!StringUtils.contains("," + globalVersions + ",", "," + currentVersion + ",")) { return msg; } String whiteList = SystemGlobals.getProperty("NO_CHECK_TAX_REGISTER_NO"); String taxRegisterNo = (String) mapParam.get(""); if (!StringUtils.contains("," + whiteList + ",", "," + taxRegisterNo + ",")) { msg.put("RESULT", "0001"); msg.put("MSG", "FAILD"); return msg; } return Collections.emptyMap(); }

蛮大人123 2019-12-02 01:57:30 0 浏览量 回答数 0

回答

String string="runoob"; String reverse = new StringBuffer(string).reverse().toString(); System.out.println("字符串反转前:"+string); System.out.println("字符串反转后:"+reverse); 这样 String string="runoob"; String reverse = new StringBuffer(string).reverse().toString(); System.out.println("字符串反转前:"+string); System.out.println("字符串反转后:"+reverse);

君浩 2019-12-02 01:04:03 0 浏览量 回答数 0

回答

/** * 思路:"abdab" 拆分情况:1.ab abd abda abdab 2.bd bda bdab 3 da dab 4 ab 5 b * */ public static String find(String str) { String reg;// 最大字符串 String left;// 剩余字符串 int k = 0;// 计数器 int len = 0;// 最大字符串的长度 String result = null;// 最终结果 for (int i = 0; i < str.length(); i++) { for (int j = 0; j < str.length() - i; j++) { if (k < (j + 1)) { // 将字符串拆分成若干个子串 reg = new String(str.substring(k, j + 1)); left = new String(str.substring(j + 1)); if (left.indexOf(reg) != -1 && reg.length() != 1) { if (reg.length() > len) { result = reg; len = reg.length(); } } } } k++; } return result; }

蛮大人123 2019-12-02 01:49:56 0 浏览量 回答数 0

问题

java 重写toString问题

蛮大人123 2019-12-01 19:47:42 949 浏览量 回答数 1

问题

关于字符串和静态方法

蛮大人123 2019-12-01 20:28:43 888 浏览量 回答数 1

问题

字符串索引越界的问题

51干警网 2019-12-01 19:40:51 983 浏览量 回答数 1

回答

private File[] upload; private String[] uploadFileName; if (upload != null) { String fileNames = ""; String fileAdds = ""; try { for (int i = 0; i < upload.length; i++) { InputStream is = new FileInputStream(upload[i]); String epName = uploadFileName[i].substring(uploadFileName[i].lastIndexOf(".")); String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString() + i + epName; String path = this.getServletRequest().getServletContext().getRealPath("/uploadfile/committee")+ "/" + fileName; OutputStream os = new FileOutputStream(path); byte buffer[] = new byte[(int) upload[i].length()]; int count = 0; while ((count = is.read(buffer)) > 0) { os.write(buffer, 0, count); } os.close(); is.close(); fileNames += uploadFileName[i] + "|"; fileAdds += "uploadfile/committee/" + fileName + "|"; } } catch (Exception e) { } advice.setFileNames(fileNames); advice.setFileAdds(fileAdds); }

蛮大人123 2019-12-02 02:04:05 0 浏览量 回答数 0

问题

Segmentation fault问题

a123456678 2019-12-01 20:10:47 1190 浏览量 回答数 1

回答

public static void main(String[] args) { String pattern=""; for(int i=0;i<20;i++){//这里的固定字符串长度是20 pattern = pattern + " "; } String kk = "abc"; String aa = String.format(pattern,kk) + "222"; System.out.println("aa="+aa); }

蛮大人123 2019-12-02 02:09:22 0 浏览量 回答数 0
阿里云大学 云服务器ECS com域名 网站域名whois查询 开发者平台 小程序定制 小程序开发 国内短信套餐包 开发者技术与产品 云数据库 图像识别 开发者问答 阿里云建站 阿里云备案 云市场 万网 阿里云帮助文档 免费套餐 开发者工具 企业信息查询 小程序开发制作 视频内容分析 企业网站制作 视频集锦 代理记账服务 2020阿里巴巴研发效能峰会 企业建站模板 云效成长地图 高端建站 云栖号弹性计算 阿里云云栖号 云栖号案例 云栖号直播