https://leetcode-cn.com/problems/convert-binary-number-in-a-linked-list-to-integer/
/*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode(int x) { val = x; }* }*/class Solution {public int getDecimalValue(ListNode head) {int res = 0;if(head == null) return res;ListNode p = head;while(p != null){res = res * 2 + p.val;p = p.next;}return res;}}
