{"id":68405,"date":"2026-01-30T04:41:19","date_gmt":"2026-01-29T20:41:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/68405.html"},"modified":"2026-01-30T04:41:19","modified_gmt":"2026-01-29T20:41:19","slug":"lcr002-%e4%ba%8c%e8%bf%9b%e5%88%b6%e6%b1%82%e5%92%8c","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/68405.html","title":{"rendered":"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260129204117-697bc5edee9fb.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>\u6c42\u89e3\u4ee3\u7801<\/h4>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token class-name\">String<\/span> <span class=\"token function\">addBinary<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span> a<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">String<\/span> b<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u5982\u679c\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>a<span class=\"token punctuation\">.<\/span><span class=\"token function\">length<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&lt;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> b<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u5982\u679c\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>b<span class=\"token punctuation\">.<\/span><span class=\"token function\">length<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&lt;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> a<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>        <span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> a<span class=\"token punctuation\">.<\/span><span class=\"token function\">length<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token keyword\">int<\/span> j <span class=\"token operator\">&#061;<\/span> b<span class=\"token punctuation\">.<\/span><span class=\"token function\">length<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u5b9a\u4e49\u8fdb\u4f4d\u53d8\u91cftmp<\/span><br \/>\n        <span class=\"token keyword\">int<\/span> tmp <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u5b9a\u4e49StringBuilder\u62fc\u63a5\u7ed3\u679c<\/span><br \/>\n        <span class=\"token class-name\">StringBuilder<\/span> sb <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">StringBuilder<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u9700\u8981\u6ce8\u610f&#xff1a;\u6700\u540e\u4e00\u4f4d\u76f8\u52a0\u4ecd\u6709\u8fdb\u4f4d\u65f6&#xff0c;\u9700\u628a\u8fdb\u4f4d1\u4e5f\u62fc\u63a5\u5230\u7ed3\u679c<\/span><br \/>\n        <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span>i <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">||<\/span> j <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">||<\/span> tmp <span class=\"token operator\">!&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><\/p>\n<p>            tmp <span class=\"token operator\">&#043;&#061;<\/span> i <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">?<\/span> a<span class=\"token punctuation\">.<\/span><span class=\"token function\">charAt<\/span><span class=\"token punctuation\">(<\/span>i<span class=\"token operator\">&#8212;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token char\">&#039;0&#039;<\/span> <span class=\"token operator\">:<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            tmp <span class=\"token operator\">&#043;&#061;<\/span> j <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">?<\/span> b<span class=\"token punctuation\">.<\/span><span class=\"token function\">charAt<\/span><span class=\"token punctuation\">(<\/span>j<span class=\"token operator\">&#8212;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token char\">&#039;0&#039;<\/span> <span class=\"token operator\">:<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            <span class=\"token comment\">\/\/ \u53d6\u4f592&#xff1a;\u5f97\u5230\u5f53\u524d\u4f4d\u7684\u8ba1\u7b97\u7ed3\u679c<\/span><br \/>\n            sb<span class=\"token punctuation\">.<\/span><span class=\"token function\">append<\/span><span class=\"token punctuation\">(<\/span>tmp <span class=\"token operator\">%<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u9664\u4ee52&#xff1a;\u66f4\u65b0\u8fdb\u4f4d\u503c<\/span><br \/>\n            tmp <span class=\"token operator\">&#061;<\/span> tmp <span class=\"token operator\">\/<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u7ed3\u679c\u9006\u5e8f&#xff1a;\u56e0\u4e3a\u662f\u4ece\u4e2a\u4f4d\u5f00\u59cb\u62fc\u63a5&#xff0c;\u9700\u8981\u53cd\u8f6c\u56de\u6b63\u5e8f&#xff0c;\u518d\u8f6c\u5b57\u7b26\u4e32\u8fd4\u56de<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> sb<span class=\"token punctuation\">.<\/span><span class=\"token function\">reverse<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">toString<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>###\u5c0f\u8d34\u58eb<\/p>\n<p>\u8fd9\u9053\u9898\u672c\u8d28\u4e0a\u5904\u7406\u65b9\u5f0f\u548c\u3010\u5b57\u8282\u9762\u8bd5\u624b\u6495\u3011\u5927\u6570\u52a0\u6cd5\u662f\u4e00\u6837\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6c42\u89e3\u4ee3\u7801<br \/>\npublic String addBinary(String a, String b) {\/\/ \u5982\u679c\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32if (a.length() &lt; 0) {return b;}\/\/ \u5982\u679c\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32if (b.length() &lt; 0) {return a;}int i  a.length() &#8211; 1;int j  b.length() &#8211; 1;\/\/ \u5b9a\u4e49\u8fdb\u4f4d\u53d8\u91cftm<\/p>\n","protected":false},"author":2,"featured_media":68404,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,190],"topic":[],"class_list":["post-68405","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/68405.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6c42\u89e3\u4ee3\u7801 public String addBinary(String a, String b) {\/\/ \u5982\u679c\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32if (a.length() &lt; 0) {return b;}\/\/ \u5982\u679c\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32if (b.length() &lt; 0) {return a;}int i a.length() - 1;int j b.length() - 1;\/\/ \u5b9a\u4e49\u8fdb\u4f4d\u53d8\u91cftm\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/68405.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-29T20:41:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260129204117-697bc5edee9fb.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/68405.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/68405.html\",\"name\":\"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-29T20:41:19+00:00\",\"dateModified\":\"2026-01-29T20:41:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/68405.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/68405.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/68405.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/68405.html","og_locale":"zh_CN","og_type":"article","og_title":"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6c42\u89e3\u4ee3\u7801 public String addBinary(String a, String b) {\/\/ \u5982\u679c\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32if (a.length() &lt; 0) {return b;}\/\/ \u5982\u679c\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32\u4e3a\u7a7a\/\u957f\u5ea6\u4e3a0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32if (b.length() &lt; 0) {return a;}int i a.length() - 1;int j b.length() - 1;\/\/ \u5b9a\u4e49\u8fdb\u4f4d\u53d8\u91cftm","og_url":"https:\/\/www.wsisp.com\/helps\/68405.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-29T20:41:19+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260129204117-697bc5edee9fb.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/68405.html","url":"https:\/\/www.wsisp.com\/helps\/68405.html","name":"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-29T20:41:19+00:00","dateModified":"2026-01-29T20:41:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/68405.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/68405.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/68405.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"LCR002-\u4e8c\u8fdb\u5236\u6c42\u548c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/68405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=68405"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/68405\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/68404"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=68405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=68405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=68405"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=68405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}